diff options
author | 2016-05-02 21:22:46 -0700 | |
---|---|---|
committer | 2016-05-02 21:22:46 -0700 | |
commit | 0bc11711b7f2f33bd4e399bda46e4c20ac4bc6ca (patch) | |
tree | cf86afd230e101ea700597a15ca0558720204b06 /include/grpc/impl/codegen/atm_gcc_sync.h | |
parent | dfbb1c080aa22e1f39cd934e1dc731ee4c74100b (diff) |
Direct translation of http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue
Diffstat (limited to 'include/grpc/impl/codegen/atm_gcc_sync.h')
-rw-r--r-- | include/grpc/impl/codegen/atm_gcc_sync.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/grpc/impl/codegen/atm_gcc_sync.h b/include/grpc/impl/codegen/atm_gcc_sync.h index 915b09fb0c..86ce2f2548 100644 --- a/include/grpc/impl/codegen/atm_gcc_sync.h +++ b/include/grpc/impl/codegen/atm_gcc_sync.h @@ -84,4 +84,11 @@ static __inline void gpr_atm_no_barrier_store(gpr_atm *p, gpr_atm value) { #define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n))) #define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n)) +static __inline gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n) { + gpr_atm cur; + do { + cur = gpr_atm_acq_load(p); + } while (!gpr_atm_rel_cas(p, cur, n)); +} + #endif /* GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H */ |