Use explicit memory order in Baton::post
authorYedidya Feldblum <yfeldblum@fb.com>
Thu, 14 Dec 2017 23:07:18 +0000 (15:07 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 14 Dec 2017 23:25:55 +0000 (15:25 -0800)
Summary: [Folly] Use explicit memory order in `Baton::post`.

Reviewed By: djwatson

Differential Revision: D6502268

fbshipit-source-id: a379ea711f165e3645ac2127a49824f46225b80a

folly/synchronization/Baton.h

index 379f9021f646e939e4cdc485491f3b37c537ba3f..96b3466169b560f339168a0cbaecca9e537ae8be 100644 (file)
@@ -128,7 +128,11 @@ struct Baton {
     assert(before == INIT || before == WAITING || before == TIMED_OUT);
 
     if (before == INIT &&
-        state_.compare_exchange_strong(before, EARLY_DELIVERY)) {
+        state_.compare_exchange_strong(
+            before,
+            EARLY_DELIVERY,
+            std::memory_order_release,
+            std::memory_order_relaxed)) {
       return;
     }