Add loopOnce() method to folly::EventBase
[folly.git] / folly / io / async / EventBase.h
index fa9a3fe5df685ca7d29599f7ea6928d5e9c994c4..46c84b8d9a803bb2a1d287f22ca7452ff76a090c 100644 (file)
@@ -143,6 +143,15 @@ class EventBase : private boost::noncopyable, public TimeoutManager {
    */
   bool loop();
 
+  /**
+   * Wait for some events to become active, run them, then return.
+   *
+   * This is useful for callers that want to run the loop manually.
+   *
+   * Returns the same result as loop().
+   */
+  bool loopOnce();
+
   /**
    * Runs the event loop.
    *
@@ -479,6 +488,8 @@ class EventBase : private boost::noncopyable, public TimeoutManager {
   typedef LoopCallback::List LoopCallbackList;
   class FunctionRunner;
 
+  bool loopBody(bool once = false);
+
   // executes any callbacks queued by runInLoop(); returns false if none found
   bool runLoopCallbacks(bool setContext = true);