6 #ifndef ABTI_SPINLOCK_H_INCLUDED
7 #define ABTI_SPINLOCK_H_INCLUDED
13 #define ABTI_SPINLOCK_STATIC_INITIALIZER() \
15 ABTD_ATOMIC_BOOL_STATIC_INITIALIZER(0) \
18 static inline ABT_bool ABTI_spinlock_is_locked(
const ABTI_spinlock *p_lock)
20 return ABTD_atomic_acquire_load_bool(&p_lock->val);
23 static inline void ABTI_spinlock_clear(ABTI_spinlock *p_lock)
25 ABTD_atomic_relaxed_clear_bool(&p_lock->val);
28 static inline void ABTI_spinlock_acquire(ABTI_spinlock *p_lock)
30 while (ABTD_atomic_test_and_set_bool(&p_lock->val)) {
31 while (ABTI_spinlock_is_locked(p_lock) !=
ABT_FALSE)
37 static inline ABT_bool ABTI_spinlock_try_acquire(ABTI_spinlock *p_lock)
42 static inline void ABTI_spinlock_release(ABTI_spinlock *p_lock)
44 ABTD_atomic_release_clear_bool(&p_lock->val);