Baton::ready, a const variant of try_wait
[folly.git] / folly / fibers / Baton.h
index d2b5885fd9dfe61f48a2523d015944214fe492a6..286ded79299cfcc090c06c178236ffc40b1e1f76 100644 (file)
@@ -40,6 +40,11 @@ class Baton {
 
   ~Baton() {}
 
+  bool ready() const {
+    auto state = waitingFiber_.load();
+    return state == POSTED;
+  }
+
   /**
    * Puts active fiber to sleep. Returns when post is called.
    */