diff options
author | Craig Tiller <ctiller@google.com> | 2017-04-06 16:09:52 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-04-06 16:09:52 -0700 |
commit | 2c3d835d66d5e26aa2695a148cae9c255e8e2a16 (patch) | |
tree | 00da8f26611d52ce2675119e0e1986efcfa241a4 /include | |
parent | 3569a76dc5f25ddf84b791a1073021cd90aa674d (diff) |
Implement gpr_atm_full_cas for Windows
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/impl/codegen/atm_windows.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/grpc/impl/codegen/atm_windows.h b/include/grpc/impl/codegen/atm_windows.h index b8f63da758..a533651f6f 100644 --- a/include/grpc/impl/codegen/atm_windows.h +++ b/include/grpc/impl/codegen/atm_windows.h @@ -95,6 +95,16 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #endif } +static __inline int gpr_atm_full_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { +#ifdef GPR_ARCH_64 + return o == (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG *)p, + (LONGLONG)n, (LONGLONG)o); +#else + return o == (gpr_atm)InterlockedCompareExchange((volatile LONG *)p, (LONG)n, + (LONG)o); +#endif +} + static __inline gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm *p, gpr_atm delta) { /* Use the CAS operation to get pointer-sized fetch and add */ |