19 #ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
20 #define COMPAT_ATOMICS_WIN32_STDATOMIC_H
26 #define ATOMIC_FLAG_INIT 0
28 #define ATOMIC_VAR_INIT(value) (value)
30 #define atomic_init(obj, value) \
35 #define kill_dependency(y) ((void)0)
37 #define atomic_thread_fence(order) \
40 #define atomic_signal_fence(order) \
43 #define atomic_is_lock_free(obj) 0
82 #define atomic_store(object, desired) \
84 *(object) = (desired); \
88 #define atomic_store_explicit(object, desired, order) \
89 atomic_store(object, desired)
91 #define atomic_load(object) \
92 (MemoryBarrier(), *(object))
94 #define atomic_load_explicit(object, order) \
97 #define atomic_exchange(object, desired) \
98 InterlockedExchangePointer(object, desired);
100 #define atomic_exchange_explicit(object, desired, order) \
101 atomic_exchange(object, desired)
106 intptr_t old = *expected;
107 *expected = InterlockedCompareExchangePointer(
object, desired, old);
108 return *expected == old;
111 #define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
112 atomic_compare_exchange_strong(object, expected, desired)
114 #define atomic_compare_exchange_weak(object, expected, desired) \
115 atomic_compare_exchange_strong(object, expected, desired)
117 #define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
118 atomic_compare_exchange_weak(object, expected, desired)
121 #define atomic_fetch_add(object, operand) \
122 InterlockedExchangeAdd64(object, operand)
124 #define atomic_fetch_sub(object, operand) \
125 InterlockedExchangeAdd64(object, -(operand))
127 #define atomic_fetch_or(object, operand) \
128 InterlockedOr64(object, operand)
130 #define atomic_fetch_xor(object, operand) \
131 InterlockedXor64(object, operand)
133 #define atomic_fetch_and(object, operand) \
134 InterlockedAnd64(object, operand)
136 #define atomic_fetch_add(object, operand) \
137 InterlockedExchangeAdd(object, operand)
139 #define atomic_fetch_sub(object, operand) \
140 InterlockedExchangeAdd(object, -(operand))
142 #define atomic_fetch_or(object, operand) \
143 InterlockedOr(object, operand)
145 #define atomic_fetch_xor(object, operand) \
146 InterlockedXor(object, operand)
148 #define atomic_fetch_and(object, operand) \
149 InterlockedAnd(object, operand)
152 #define atomic_fetch_add_explicit(object, operand, order) \
153 atomic_fetch_add(object, operand)
155 #define atomic_fetch_sub_explicit(object, operand, order) \
156 atomic_fetch_sub(object, operand)
158 #define atomic_fetch_or_explicit(object, operand, order) \
159 atomic_fetch_or(object, operand)
161 #define atomic_fetch_xor_explicit(object, operand, order) \
162 atomic_fetch_xor(object, operand)
164 #define atomic_fetch_and_explicit(object, operand, order) \
165 atomic_fetch_and(object, operand)
167 #define atomic_flag_test_and_set(object) \
168 atomic_exchange(object, 1)
170 #define atomic_flag_test_and_set_explicit(object, order) \
171 atomic_flag_test_and_set(object)
173 #define atomic_flag_clear(object) \
174 atomic_store(object, 0)
176 #define atomic_flag_clear_explicit(object, order) \
177 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
static int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected, intptr_t desired)
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