Allow access to a FiberManager's currently running fiber
authorBrian Watling <bwatling@fb.com>
Mon, 20 Jul 2015 18:46:02 +0000 (11:46 -0700)
committerSara Golemon <sgolemon@fb.com>
Mon, 20 Jul 2015 19:26:33 +0000 (12:26 -0700)
Summary: Allow access to a FiberManager's currently running fiber

Reviewed By: @alikhtarov, @andriigrynenko

Differential Revision: D2257201

folly/experimental/fibers/FiberManager.h

index a29c6c2f56069fcaa6a1393cc3d1cf7553b0fe4a..fc8890696a9d241cef6316c372da13f42f9895d2 100644 (file)
@@ -224,6 +224,13 @@ class FiberManager : public ::folly::Executor {
    */
   bool hasActiveFiber() const;
 
+  /**
+   * @return The currently running fiber or null if no fiber is executing.
+   */
+  Fiber* currentFiber() const {
+    return currentFiber_;
+  }
+
   /**
    * @return What was the most observed fiber stack usage (in bytes).
    */