From: Nathan Bronson Date: Fri, 19 Jan 2018 20:41:05 +0000 (-0800) Subject: remove closure from assert X-Git-Tag: v2018.01.22.00~3 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=e3d4b1ba20bcc2393eb3fb0fbc4bae9d68968093 remove closure from assert Summary: Somebody reported compilation issues with the closure in post()'s assert, resulting in "error: lambda-expression in unevaluated context". While I haven't been able to reproduce the problem locally, it is easy enough to work around in this case. Reviewed By: djwatson, mcallahan Differential Revision: D6759739 fbshipit-source-id: 9f8082a1e20cd9ddf626cb176542e4e861a7e702 --- diff --git a/folly/synchronization/Baton.h b/folly/synchronization/Baton.h index f483bd5d..660a430c 100644 --- a/folly/synchronization/Baton.h +++ b/folly/synchronization/Baton.h @@ -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; }