Lines Matching +full:- +full:m
4 * SPDX-License-Identifier: Apache-2.0
39 static inline size_t posix_mutex_to_offset(struct k_mutex *m) in posix_mutex_to_offset() argument
41 return m - posix_mutex_pool; in posix_mutex_to_offset()
76 struct k_mutex *m; in to_posix_mutex() local
92 m = &posix_mutex_pool[bit]; in to_posix_mutex()
94 err = k_mutex_init(m); in to_posix_mutex()
97 return m; in to_posix_mutex()
105 struct k_mutex *m; in acquire_mutex() local
108 m = to_posix_mutex(mu); in acquire_mutex()
109 if (m == NULL) { in acquire_mutex()
113 bit = posix_mutex_to_offset(m); in acquire_mutex()
117 if (m->owner == k_current_get()) { in acquire_mutex()
132 if (m->lock_count >= MUTEX_MAX_REC_LOCK) { in acquire_mutex()
148 ret = k_mutex_lock(m, timeout); in acquire_mutex()
152 ret = -ret; in acquire_mutex()
159 * @brief Lock POSIX mutex with non-blocking call.
163 int pthread_mutex_trylock(pthread_mutex_t *m) in pthread_mutex_trylock() argument
165 return acquire_mutex(m, K_NO_WAIT); in pthread_mutex_trylock()
174 int pthread_mutex_timedlock(pthread_mutex_t *m, in pthread_mutex_timedlock() argument
178 return acquire_mutex(m, K_MSEC(timeout)); in pthread_mutex_timedlock()
189 struct k_mutex *m; in pthread_mutex_init() local
194 m = to_posix_mutex(mu); in pthread_mutex_init()
195 if (m == NULL) { in pthread_mutex_init()
199 bit = posix_mutex_to_offset(m); in pthread_mutex_init()
203 posix_mutex_type[bit] = attr->type; in pthread_mutex_init()
215 int pthread_mutex_lock(pthread_mutex_t *m) in pthread_mutex_lock() argument
217 return acquire_mutex(m, K_FOREVER); in pthread_mutex_lock()
228 struct k_mutex *m; in pthread_mutex_unlock() local
230 m = get_posix_mutex(*mu); in pthread_mutex_unlock()
231 if (m == NULL) { in pthread_mutex_unlock()
235 ret = k_mutex_unlock(m); in pthread_mutex_unlock()
237 return -ret; in pthread_mutex_unlock()
254 struct k_mutex *m; in pthread_mutex_destroy() local
256 m = get_posix_mutex(*mu); in pthread_mutex_destroy()
257 if (m == NULL) { in pthread_mutex_destroy()
289 *type = attr->type; in pthread_mutexattr_gettype()
306 attr->type = type; in pthread_mutexattr_settype()