24 #ifndef COMPAT_ATOMICS_GCC_STDATOMIC_H 25 #define COMPAT_ATOMICS_GCC_STDATOMIC_H 30 #define ATOMIC_FLAG_INIT 0 32 #define ATOMIC_VAR_INIT(value) (value) 34 #define atomic_init(obj, value) \ 39 #define kill_dependency(y) ((void)0) 41 #define atomic_thread_fence(order) \ 44 #define atomic_signal_fence(order) \ 47 #define atomic_is_lock_free(obj) 0 86 #define atomic_store(object, desired) \ 88 *(object) = (desired); \ 89 __sync_synchronize(); \ 92 #define atomic_store_explicit(object, desired, order) \ 93 atomic_store(object, desired) 95 #define atomic_load(object) \ 96 (__sync_synchronize(), *(object)) 98 #define atomic_load_explicit(object, order) \ 101 #define atomic_exchange(object, desired) \ 103 __typeof__(object) _obj = (object); \ 104 __typeof__(*object) _old; \ 106 _old = atomic_load(_obj); \ 107 while (!__sync_bool_compare_and_swap(_obj, _old, (desired))); \ 111 #define atomic_exchange_explicit(object, desired, order) \ 112 atomic_exchange(object, desired) 114 #define atomic_compare_exchange_strong(object, expected, desired) \ 116 __typeof__(object) _exp = (expected); \ 117 __typeof__(*object) _old = *_exp; \ 118 *_exp = __sync_val_compare_and_swap((object), _old, (desired)); \ 122 #define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ 123 atomic_compare_exchange_strong(object, expected, desired) 125 #define atomic_compare_exchange_weak(object, expected, desired) \ 126 atomic_compare_exchange_strong(object, expected, desired) 128 #define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ 129 atomic_compare_exchange_weak(object, expected, desired) 131 #define atomic_fetch_add(object, operand) \ 132 __sync_fetch_and_add(object, operand) 134 #define atomic_fetch_add_explicit(object, operand, order) \ 135 atomic_fetch_add(object, operand) 137 #define atomic_fetch_sub(object, operand) \ 138 __sync_fetch_and_sub(object, operand) 140 #define atomic_fetch_sub_explicit(object, operand, order) \ 141 atomic_fetch_sub(object, operand) 143 #define atomic_fetch_or(object, operand) \ 144 __sync_fetch_and_or(object, operand) 146 #define atomic_fetch_or_explicit(object, operand, order) \ 147 atomic_fetch_or(object, operand) 149 #define atomic_fetch_xor(object, operand) \ 150 __sync_fetch_and_xor(object, operand) 152 #define atomic_fetch_xor_explicit(object, operand, order) \ 153 atomic_fetch_xor(object, operand) 155 #define atomic_fetch_and(object, operand) \ 156 __sync_fetch_and_and(object, operand) 158 #define atomic_fetch_and_explicit(object, operand, order) \ 159 atomic_fetch_and(object, operand) 161 #define atomic_flag_test_and_set(object) \ 162 atomic_exchange(object, 1) 164 #define atomic_flag_test_and_set_explicit(object, order) \ 165 atomic_flag_test_and_set(object) 167 #define atomic_flag_clear(object) \ 168 atomic_store(object, 0) 170 #define atomic_flag_clear_explicit(object, order) \ 171 atomic_flag_clear(object)
intptr_t atomic_uint_fast8_t
intptr_t atomic_int_least8_t
intptr_t atomic_int_least32_t
intptr_t atomic_int_fast16_t
intptr_t atomic_uintptr_t
intptr_t atomic_int_fast32_t
intptr_t atomic_int_fast8_t
intptr_t atomic_uint_fast16_t
intptr_t atomic_int_least16_t
intptr_t atomic_uint_fast32_t
intptr_t atomic_uint_least32_t
intptr_t atomic_int_fast64_t
intptr_t atomic_uint_least16_t
intptr_t atomic_uint_fast64_t
intptr_t atomic_uintmax_t
intptr_t atomic_int_least64_t
intptr_t atomic_ptrdiff_t
intptr_t atomic_uint_least8_t
intptr_t atomic_uint_least64_t