21 #ifndef P99_ATOMIC_FLAG_H_
22 #define P99_ATOMIC_FLAG_H_ 1
35 void atomic_flag_lock(
volatile atomic_flag *p00_objp) {
36 while (atomic_flag_test_and_set_explicit(p00_objp, memory_order_acquire));
51 _Bool atomic_flag_trylock(
volatile atomic_flag *p00_objp) {
52 return !atomic_flag_test_and_set_explicit(p00_objp, memory_order_acquire);
63 void atomic_flag_unlock(
volatile atomic_flag *p00_objp) {
64 atomic_flag_clear_explicit(p00_objp, memory_order_release);
90 #define P99_SPIN_EXCLUDE(FLAGP) P00_SPIN_EXCLUDE(FLAGP, P99_UNIQ(flg))
92 #define P00_SPIN_EXCLUDE(FLAGP, ID) \
94 P00_BLK_DECL(register atomic_flag volatile*const, ID, (FLAGP)) \
95 P00_BLK_BEFAFT(atomic_flag_lock(ID), \
96 atomic_flag_unlock(ID)) \