Commit e967876f authored by Martin Martin's avatar Martin Martin Committed by Facebook Github Bot 1

Fix a data race found by TSAN in folly::fibers::Baton

Summary: Fix a data race found by TSAN in folly::fibers::Baton by changing a memory_order_relaxed to memory_order_acquire.  Nathan Bronson says that TSAN is correct and the C++ memory model requires _acquire here.

Reviewed By: andriigrynenko

Differential Revision: D3412519

fbshipit-source-id: bd0043b41d145e689a97fc7ef47aa6e116ea9194
parent 3619ec97
...@@ -58,7 +58,7 @@ void Baton::waitThread() { ...@@ -58,7 +58,7 @@ void Baton::waitThread() {
waitingFiber_.compare_exchange_strong(fiber, THREAD_WAITING))) { waitingFiber_.compare_exchange_strong(fiber, THREAD_WAITING))) {
do { do {
folly::detail::MemoryIdler::futexWait(futex_.futex, THREAD_WAITING); folly::detail::MemoryIdler::futexWait(futex_.futex, THREAD_WAITING);
fiber = waitingFiber_.load(std::memory_order_relaxed); fiber = waitingFiber_.load(std::memory_order_acquire);
} while (fiber == THREAD_WAITING); } while (fiber == THREAD_WAITING);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment