Commit c1ad7544 authored by Dave Watson's avatar Dave Watson Committed by Alecs King

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
parent 2aed11df
......@@ -24,6 +24,7 @@
#include <vector>
#include <folly/AtomicLinkedList.h>
#include <folly/Executor.h>
#include <folly/Likely.h>
#include <folly/IntrusiveList.h>
#include <folly/futures/Try.h>
......@@ -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 <typename F>
void addTaskRemote(F&& func);
// Executor interface calls addTaskRemote
void add(std::function<void()> f) {
addTaskRemote(std::move(f));
}
/**
* Add a new task. When the task is complete, execute finally(Try<Result>&&)
* on the main context.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment