Compare‐exchange (strong) that works around a TSAN bug in the standard library version.
Synopsis
Declared in <folly/synchronization/AtomicUtil.h>
template<
template<typename> typename Atom = atomic,
typename T>
bool
atomic_compare_exchange_strong_explicit(
Atom<T>* obj,
T* expected,
T desired,
std::memory_order succ,
std::memory_order fail);
Description
Workaround for https://github.com/google/sanitizers/issues/970. Mimics std::atomic_compare_exchange_strong.
Return Value
true if the exchange succeeded, otherwise false.
Parameters
Name |
Description |
obj |
The atomic object to operate on. |
expected |
Pointer to the expected value; updated on failure. |
desired |
The value to store on success. |
succ |
The memory order on success. |
fail |
The memory order on failure. |
Created with MrDocs