Lines Matching refs:m
44 static inline size_t posix_mutex_to_offset(struct k_mutex *m) in posix_mutex_to_offset() argument
46 return m - posix_mutex_pool; in posix_mutex_to_offset()
84 struct k_mutex *m; in to_posix_mutex() local
100 m = &posix_mutex_pool[bit]; in to_posix_mutex()
102 err = k_mutex_init(m); in to_posix_mutex()
105 return m; in to_posix_mutex()
114 struct k_mutex *m = NULL; in acquire_mutex() local
118 m = to_posix_mutex(mu); in acquire_mutex()
119 if (m == NULL) { in acquire_mutex()
124 LOG_DBG("Locking mutex %p with timeout %llx", m, timeout.ticks); in acquire_mutex()
127 bit = posix_mutex_to_offset(m); in acquire_mutex()
129 owner = m->owner; in acquire_mutex()
130 lock_count = m->lock_count; in acquire_mutex()
141 LOG_DBG("Timeout locking mutex %p", m); in acquire_mutex()
146 LOG_DBG("Attempt to relock non-recursive mutex %p", m); in acquire_mutex()
154 LOG_DBG("Mutex %p locked recursively too many times", m); in acquire_mutex()
159 LOG_DBG("Attempt to recursively lock non-recursive mutex %p", m); in acquire_mutex()
170 ret = k_mutex_lock(m, timeout); in acquire_mutex()
172 LOG_DBG("Timeout locking mutex %p", m); in acquire_mutex()
188 LOG_DBG("Locked mutex %p", m); in acquire_mutex()
199 int pthread_mutex_trylock(pthread_mutex_t *m) in pthread_mutex_trylock() argument
201 return acquire_mutex(m, K_NO_WAIT); in pthread_mutex_trylock()
210 int pthread_mutex_timedlock(pthread_mutex_t *m, in pthread_mutex_timedlock() argument
214 return acquire_mutex(m, K_MSEC(timeout)); in pthread_mutex_timedlock()
225 struct k_mutex *m; in pthread_mutex_init() local
230 m = to_posix_mutex(mu); in pthread_mutex_init()
231 if (m == NULL) { in pthread_mutex_init()
235 bit = posix_mutex_to_offset(m); in pthread_mutex_init()
242 LOG_DBG("Initialized mutex %p", m); in pthread_mutex_init()
253 int pthread_mutex_lock(pthread_mutex_t *m) in pthread_mutex_lock() argument
255 return acquire_mutex(m, K_FOREVER); in pthread_mutex_lock()
266 struct k_mutex *m; in pthread_mutex_unlock() local
268 m = get_posix_mutex(*mu); in pthread_mutex_unlock()
269 if (m == NULL) { in pthread_mutex_unlock()
273 ret = k_mutex_unlock(m); in pthread_mutex_unlock()
280 LOG_DBG("Unlocked mutex %p", m); in pthread_mutex_unlock()
294 struct k_mutex *m; in pthread_mutex_destroy() local
296 m = get_posix_mutex(*mu); in pthread_mutex_destroy()
297 if (m == NULL) { in pthread_mutex_destroy()
305 LOG_DBG("Destroyed mutex %p", m); in pthread_mutex_destroy()