41 ABTI_UB_ASSERT(ABTI_initialized());
42 ABTI_UB_ASSERT(newmutex);
47 #ifndef ABT_CONFIG_ENABLE_VER_20_API
51 ABTI_mutex *p_newmutex;
53 int abt_errno =
ABTU_malloc(
sizeof(ABTI_mutex), (
void **)&p_newmutex);
54 ABTI_CHECK_ERROR(abt_errno);
55 ABTI_mutex_init(p_newmutex);
58 *newmutex = ABTI_mutex_get_handle(p_newmutex);
103 ABTI_UB_ASSERT(ABTI_initialized());
104 ABTI_UB_ASSERT(newmutex);
106 #ifndef ABT_CONFIG_ENABLE_VER_20_API
110 ABTI_mutex_attr *p_attr = ABTI_mutex_attr_get_ptr(attr);
111 ABTI_mutex *p_newmutex;
113 int abt_errno =
ABTU_malloc(
sizeof(ABTI_mutex), (
void **)&p_newmutex);
114 ABTI_CHECK_ERROR(abt_errno);
116 ABTI_mutex_init(p_newmutex);
118 p_newmutex->attrs = p_attr->attrs;
121 *newmutex = ABTI_mutex_get_handle(p_newmutex);
153 ABTI_UB_ASSERT(ABTI_initialized());
154 ABTI_UB_ASSERT(mutex);
157 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(h_mutex);
158 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
191 ABTI_local *p_local = ABTI_local_get_local();
192 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
193 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
194 ABTI_mutex_lock(&p_local, p_mutex);
225 ABTI_local *p_local = ABTI_local_get_local();
226 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
227 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
228 ABTI_mutex_lock(&p_local, p_mutex);
259 ABTI_local *p_local = ABTI_local_get_local();
260 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
261 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
262 ABTI_mutex_lock(&p_local, p_mutex);
294 ABTI_local *p_local = ABTI_local_get_local();
295 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
296 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
297 int abt_errno = ABTI_mutex_trylock(p_local, p_mutex);
334 ABTI_local *p_local = ABTI_local_get_local();
335 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
336 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
337 ABTI_mutex_spinlock(p_local, p_mutex);
367 ABTI_local *p_local = ABTI_local_get_local();
368 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
369 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
373 ABTI_UB_ASSERT(ABTI_mutex_is_locked(p_mutex));
375 ABTI_UB_ASSERT(!((p_mutex->attrs & ABTI_MUTEX_ATTR_RECURSIVE) &&
376 p_mutex->owner_id != ABTI_self_get_thread_id(p_local)));
378 ABTI_mutex_unlock(p_local, p_mutex);
419 ABTI_local *p_local = ABTI_local_get_local();
420 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
421 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
425 ABTI_UB_ASSERT(ABTI_mutex_is_locked(p_mutex));
427 ABTI_UB_ASSERT(!((p_mutex->attrs & ABTI_MUTEX_ATTR_RECURSIVE) &&
428 p_mutex->owner_id != ABTI_self_get_thread_id(p_local)));
430 ABTI_mutex_unlock(p_local, p_mutex);
471 ABTI_local *p_local = ABTI_local_get_local();
472 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
473 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
477 ABTI_UB_ASSERT(ABTI_mutex_is_locked(p_mutex));
479 ABTI_UB_ASSERT(!((p_mutex->attrs & ABTI_MUTEX_ATTR_RECURSIVE) &&
480 p_mutex->owner_id != ABTI_self_get_thread_id(p_local)));
482 ABTI_mutex_unlock(p_local, p_mutex);
515 ABTI_UB_ASSERT(result);
517 ABTI_mutex *p_mutex1 = ABTI_mutex_get_ptr(mutex1);
518 ABTI_mutex *p_mutex2 = ABTI_mutex_get_ptr(mutex2);
550 ABTI_UB_ASSERT(ABTI_initialized());
551 ABTI_UB_ASSERT(attr);
553 ABTI_mutex *p_mutex = ABTI_mutex_get_ptr(mutex);
554 ABTI_CHECK_NULL_MUTEX_PTR(p_mutex);
556 ABTI_mutex_attr *p_newattr;
557 int abt_errno =
ABTU_malloc(
sizeof(ABTI_mutex_attr), (
void **)&p_newattr);
558 ABTI_CHECK_ERROR(abt_errno);
561 p_newattr->attrs = p_mutex->attrs;
564 *attr = ABTI_mutex_attr_get_handle(p_newattr);