Add a full drain for folly's ManualExecutor.
[folly.git] / folly / executors / ManualExecutor.h
index 028a4ce63af03490c1b0d183cdf6ea725c9e6f2e..bfaaf259472349b58b43641a00d7211f961bad0d 100644 (file)
@@ -47,6 +47,14 @@ namespace folly {
     /// moment that this returns.
     size_t run();
 
+    // Do work until there is no more work to do.
+    // Returns the number of functions that were executed (maybe 0).
+    // Unlike run, this method is not stable. It will chase an infinite tail of
+    // work so should be used with care.
+    // There will be no work available to perform at the moment that this
+    // returns.
+    size_t drain();
+
     /// Wait for work to do.
     void wait();