From c1ad75447b8903ab259127339e11bfb096ee49a7 Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Thu, 23 Apr 2015 10:03:51 -0700 Subject: [PATCH] Change ThreadManager interface to Executor Summary: Change ThreadManager interface to more generic Executor interface. Specific example of supporting fibers. This diff would replace D1967655 Test Plan: added several unittests Reviewed By: alandau@fb.com Subscribers: doug, alandau, bmatheny, mshneer, folly-diffs@, jsedgwick, yfeldblum, chalfant, alikhtarov, andrii, yitingli FB internal diff: D1994663 Signature: t1:1994663:1429640509:d729ce6f020563b680d1d549f9aa273c739eb925 --- folly/experimental/fibers/FiberManager.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/folly/experimental/fibers/FiberManager.h b/folly/experimental/fibers/FiberManager.h index fa4e14aa..8ce9fc34 100644 --- a/folly/experimental/fibers/FiberManager.h +++ b/folly/experimental/fibers/FiberManager.h @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -57,7 +58,7 @@ class LocalType { * call. This will pause execution of this task and it will be resumed only * when it is unblocked (via setData()). */ -class FiberManager { +class FiberManager : public ::folly::Executor { public: struct Options { #ifdef FOLLY_SANITIZE_ADDRESS @@ -170,6 +171,11 @@ class FiberManager { template void addTaskRemote(F&& func); + // Executor interface calls addTaskRemote + void add(std::function f) { + addTaskRemote(std::move(f)); + } + /** * Add a new task. When the task is complete, execute finally(Try&&) * on the main context. -- 2.34.1