remove closure from assert
[folly.git] / folly / synchronization / Baton.h
index f483bd5dd8dd27676a8860caf0480497a85b5ddd..660a430c14d87c0e0c086aebfa87e5065981a59c 100644 (file)
@@ -123,10 +123,9 @@ class Baton {
     if (!MayBlock) {
       /// Spin-only version
       ///
-      assert([&] {
-        auto state = state_.load(std::memory_order_relaxed);
-        return (state == INIT || state == EARLY_DELIVERY);
-      }());
+      assert(
+          ((1 << state_.load(std::memory_order_relaxed)) &
+           ((1 << INIT) | (1 << EARLY_DELIVERY))) != 0);
       state_.store(EARLY_DELIVERY, std::memory_order_release);
       return;
     }