19 #ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
20 #define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
33 #define GPR_ATM_MAX INTPTR_MAX
34 #define GPR_ATM_MIN INTPTR_MIN
36 #define gpr_atm_full_barrier() (__atomic_thread_fence(__ATOMIC_SEQ_CST))
38 #define gpr_atm_acq_load(p) (__atomic_load_n((p), __ATOMIC_ACQUIRE))
39 #define gpr_atm_no_barrier_load(p) (__atomic_load_n((p), __ATOMIC_RELAXED))
40 #define gpr_atm_rel_store(p, value) \
41 (__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELEASE))
42 #define gpr_atm_no_barrier_store(p, value) \
43 (__atomic_store_n((p), (intptr_t)(value), __ATOMIC_RELAXED))
45 #define gpr_atm_no_barrier_fetch_add(p, delta) \
46 __atomic_fetch_add((p), (intptr_t)(delta), __ATOMIC_RELAXED)
47 #define gpr_atm_full_fetch_add(p, delta) \
48 __atomic_fetch_add((p), (intptr_t)(delta), __ATOMIC_ACQ_REL)
53 return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_RELAXED,
60 return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_ACQUIRE,
67 return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_RELEASE,
74 return __atomic_compare_exchange_n(p, &o, n, 0, __ATOMIC_ACQ_REL,
78 #define gpr_atm_full_xchg(p, n) __atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL)