diff options
author | 2017-03-20 06:45:39 -0700 | |
---|---|---|
committer | 2017-03-20 06:45:39 -0700 | |
commit | d2164409343445e1f2de62b210218ad05c75d4c9 (patch) | |
tree | acbf415c7719a7830b42b95634acb1d3ed3e9597 /include/grpc/impl/codegen/atm_gcc_atomic.h | |
parent | ca3154d7c8edadcd84e1e199264c30a7f285058e (diff) |
Switch to no-barrier loads + full barrier cas-s to solve ABA problem
Diffstat (limited to 'include/grpc/impl/codegen/atm_gcc_atomic.h')
-rw-r--r-- | include/grpc/impl/codegen/atm_gcc_atomic.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/grpc/impl/codegen/atm_gcc_atomic.h b/include/grpc/impl/codegen/atm_gcc_atomic.h index 4bd3b25741..a486258c77 100644 --- a/include/grpc/impl/codegen/atm_gcc_atomic.h +++ b/include/grpc/impl/codegen/atm_gcc_atomic.h @@ -85,6 +85,11 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { p, &o, n, 0, __ATOMIC_RELEASE, __ATOMIC_RELAXED)); } +static __inline int gpr_atm_full_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { + return GPR_ATM_INC_CAS_THEN(__atomic_compare_exchange_n( + p, &o, n, 0, __ATOMIC_ACQ_REL, __ATOMIC_RELAXED)); +} + #define gpr_atm_full_xchg(p, n) \ GPR_ATM_INC_CAS_THEN(__atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL)) |