From e6cae04e5f77f2f5f113fc9cc6a5e7b09ede644e Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Wed, 20 Mar 2019 10:44:07 -0400 Subject: [PATCH] Fix a typo in CompareExchangeStrong() Use compare_exchange_strong() instead of compare_exchange_weak(), which can be spuriously fail on some platforms. Thanks to Mark Roth to pointing this out! --- src/core/lib/gprpp/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/gprpp/atomic.h b/src/core/lib/gprpp/atomic.h index aec283c50dc..80412ef9583 100644 --- a/src/core/lib/gprpp/atomic.h +++ b/src/core/lib/gprpp/atomic.h @@ -58,7 +58,7 @@ class Atomic { bool CompareExchangeStrong(T* expected, T desired, MemoryOrder success, MemoryOrder failure) { - return GPR_ATM_INC_CAS_THEN(storage_.compare_exchange_weak( + return GPR_ATM_INC_CAS_THEN(storage_.compare_exchange_strong( *expected, desired, static_cast(success), static_cast(failure))); }