diff options
author | Craig Tiller <ctiller@google.com> | 2015-07-30 09:59:25 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-07-30 11:58:14 -0700 |
commit | 42b6c93c36d818a75344d16e353144a0e609e01e (patch) | |
tree | 4be33b7f893d54bb8d17c155eb4975816a30ad19 /include | |
parent | c226edcadcff312b8db25288800958669ad31142 (diff) |
Make TSAN happy with our lock free stack
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/support/atm_gcc_atomic.h | 2 | ||||
-rw-r--r-- | include/grpc/support/atm_gcc_sync.h | 5 | ||||
-rw-r--r-- | include/grpc/support/atm_win32.h | 5 |
3 files changed, 12 insertions, 0 deletions
diff --git a/include/grpc/support/atm_gcc_atomic.h b/include/grpc/support/atm_gcc_atomic.h index 65d3d0c60f..a2c8386028 100644 --- a/include/grpc/support/atm_gcc_atomic.h +++ b/include/grpc/support/atm_gcc_atomic.h @@ -46,6 +46,8 @@ typedef gpr_intptr gpr_atm; #define gpr_atm_no_barrier_load(p) (__atomic_load_n((p), __ATOMIC_RELAXED)) #define gpr_atm_rel_store(p, value) \ (__atomic_store_n((p), (gpr_intptr)(value), __ATOMIC_RELEASE)) +#define gpr_atm_no_barrier_store(p, value) \ + (__atomic_store_n((p), (gpr_intptr)(value), __ATOMIC_RELAXED)) #define gpr_atm_no_barrier_fetch_add(p, delta) \ (__atomic_fetch_add((p), (gpr_intptr)(delta), __ATOMIC_RELAXED)) diff --git a/include/grpc/support/atm_gcc_sync.h b/include/grpc/support/atm_gcc_sync.h index 4955e4436f..38b5a9eec2 100644 --- a/include/grpc/support/atm_gcc_sync.h +++ b/include/grpc/support/atm_gcc_sync.h @@ -68,6 +68,11 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) { *p = value; } +static __inline void gpr_atm_no_barrier_store(gpr_atm *p, gpr_atm value) { + GPR_ATM_COMPILE_BARRIER_(); + *p = value; +} + #undef GPR_ATM_LS_BARRIER_ #undef GPR_ATM_COMPILE_BARRIER_ diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index da99021c24..694528a9ba 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -57,6 +57,11 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) { *p = value; } +static __inline void gpr_atm_no_barrier_store(gpr_atm *p, gpr_atm value) { + /* TODO(ctiller): Can we implement something better here? */ + gpr_atm_rel_store(p, value); +} + static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { /* InterlockedCompareExchangePointerNoFence() not available on vista or windows7 */ |