Lines Matching refs:m

43 static inline size_t posix_mutex_to_offset(struct k_mutex *m)  in posix_mutex_to_offset()  argument
45 return m - posix_mutex_pool; in posix_mutex_to_offset()
83 struct k_mutex *m; in to_posix_mutex() local
99 m = &posix_mutex_pool[bit]; in to_posix_mutex()
101 err = k_mutex_init(m); in to_posix_mutex()
104 return m; in to_posix_mutex()
112 struct k_mutex *m; in acquire_mutex() local
117 m = to_posix_mutex(mu); in acquire_mutex()
118 if (m == NULL) { in acquire_mutex()
123 LOG_DBG("Locking mutex %p with timeout %llx", m, timeout.ticks); in acquire_mutex()
125 bit = posix_mutex_to_offset(m); in acquire_mutex()
128 if (m->owner == k_current_get()) { in acquire_mutex()
133 LOG_DBG("Timeout locking mutex %p", m); in acquire_mutex()
138 LOG_DBG("Attempt to relock non-recursive mutex %p", m); in acquire_mutex()
145 if (m->lock_count >= MUTEX_MAX_REC_LOCK) { in acquire_mutex()
146 LOG_DBG("Mutex %p locked recursively too many times", m); in acquire_mutex()
151 LOG_DBG("Attempt to recursively lock non-recursive mutex %p", m); in acquire_mutex()
163 ret = k_mutex_lock(m, timeout); in acquire_mutex()
165 LOG_DBG("Timeout locking mutex %p", m); in acquire_mutex()
180 LOG_DBG("Locked mutex %p", m); in acquire_mutex()
191 int pthread_mutex_trylock(pthread_mutex_t *m) in pthread_mutex_trylock() argument
193 return acquire_mutex(m, K_NO_WAIT); in pthread_mutex_trylock()
202 int pthread_mutex_timedlock(pthread_mutex_t *m, in pthread_mutex_timedlock() argument
206 return acquire_mutex(m, K_MSEC(timeout)); in pthread_mutex_timedlock()
217 struct k_mutex *m; in pthread_mutex_init() local
222 m = to_posix_mutex(mu); in pthread_mutex_init()
223 if (m == NULL) { in pthread_mutex_init()
227 bit = posix_mutex_to_offset(m); in pthread_mutex_init()
234 LOG_DBG("Initialized mutex %p", m); in pthread_mutex_init()
245 int pthread_mutex_lock(pthread_mutex_t *m) in pthread_mutex_lock() argument
247 return acquire_mutex(m, K_FOREVER); in pthread_mutex_lock()
258 struct k_mutex *m; in pthread_mutex_unlock() local
260 m = get_posix_mutex(*mu); in pthread_mutex_unlock()
261 if (m == NULL) { in pthread_mutex_unlock()
265 ret = k_mutex_unlock(m); in pthread_mutex_unlock()
272 LOG_DBG("Unlocked mutex %p", m); in pthread_mutex_unlock()
286 struct k_mutex *m; in pthread_mutex_destroy() local
288 m = get_posix_mutex(*mu); in pthread_mutex_destroy()
289 if (m == NULL) { in pthread_mutex_destroy()
297 LOG_DBG("Destroyed mutex %p", m); in pthread_mutex_destroy()