proxygen
|
#include <ThreadedExecutor.h>
Public Member Functions | |
ThreadedExecutor (std::shared_ptr< ThreadFactory > threadFactory=newDefaultThreadFactory()) | |
~ThreadedExecutor () override | |
ThreadedExecutor (ThreadedExecutor const &)=delete | |
ThreadedExecutor (ThreadedExecutor &&)=delete | |
ThreadedExecutor & | operator= (ThreadedExecutor const &)=delete |
ThreadedExecutor & | operator= (ThreadedExecutor &&)=delete |
void | add (Func func) override |
Public Member Functions inherited from folly::Executor | |
virtual | ~Executor () |
virtual void | addWithPriority (Func, int8_t priority) |
virtual uint8_t | getNumPriorities () const |
Private Member Functions | |
void | notify () |
void | control () |
void | controlWait () |
bool | controlPerformAll () |
void | controlJoinFinishedThreads () |
void | controlLaunchEnqueuedTasks () |
void | work (Func &func) |
Static Private Member Functions | |
static std::shared_ptr< ThreadFactory > | newDefaultThreadFactory () |
Private Attributes | |
std::shared_ptr< ThreadFactory > | threadFactory_ |
std::atomic< bool > | stopping_ {false} |
std::mutex | controlm_ |
std::condition_variable | controlc_ |
bool | controls_ = false |
std::thread | controlt_ |
std::mutex | enqueuedm_ |
std::deque< Func > | enqueued_ |
std::map< std::thread::id, std::thread > | running_ |
std::mutex | finishedm_ |
std::deque< std::thread::id > | finished_ |
Additional Inherited Members | |
Static Public Member Functions inherited from folly::Executor | |
template<typename ExecutorT > | |
static KeepAlive< ExecutorT > | getKeepAliveToken (ExecutorT *executor) |
template<typename ExecutorT > | |
static KeepAlive< ExecutorT > | getKeepAliveToken (ExecutorT &executor) |
Static Public Attributes inherited from folly::Executor | |
static const int8_t | LO_PRI = SCHAR_MIN |
static const int8_t | MID_PRI = 0 |
static const int8_t | HI_PRI = SCHAR_MAX |
Protected Member Functions inherited from folly::Executor | |
virtual bool | keepAliveAcquire () |
virtual void | keepAliveRelease () |
Static Protected Member Functions inherited from folly::Executor | |
template<typename ExecutorT > | |
static bool | isKeepAliveDummy (const KeepAlive< ExecutorT > &keepAlive) |
template<typename ExecutorT > | |
static KeepAlive< ExecutorT > | makeKeepAlive (ExecutorT *executor) |
Definition at line 55 of file ThreadedExecutor.h.
|
explicit |
Definition at line 34 of file ThreadedExecutor.cpp.
References control(), and controlt_.
|
override |
Definition at line 39 of file ThreadedExecutor.cpp.
References controlt_, finished_, notify(), running_, and stopping_.
|
delete |
|
delete |
|
overridevirtual |
Enqueue a function to executed by this executor. This and all variants must be threadsafe.
Implements folly::Executor.
Definition at line 47 of file ThreadedExecutor.cpp.
References enqueued_, enqueuedm_, folly::gen::move, notify(), stopping_, and folly::with_unique_lock().
|
private |
Definition at line 62 of file ThreadedExecutor.cpp.
References controlPerformAll(), controlWait(), and folly::setThreadName().
Referenced by ThreadedExecutor().
|
private |
Definition at line 85 of file ThreadedExecutor.cpp.
References finished_, finishedm_, running_, folly::f14::swap(), and folly::with_unique_lock().
Referenced by controlPerformAll().
|
private |
Definition at line 94 of file ThreadedExecutor.cpp.
References enqueued_, enqueuedm_, f, folly::gen::move, running_, folly::f14::swap(), threadFactory_, folly::with_unique_lock(), and work().
Referenced by controlPerformAll().
|
private |
Definition at line 105 of file ThreadedExecutor.cpp.
References controlJoinFinishedThreads(), controlLaunchEnqueuedTasks(), running_, and stopping_.
Referenced by control().
|
private |
Definition at line 71 of file ThreadedExecutor.cpp.
References controlc_, controlm_, controls_, and folly::lock().
Referenced by control().
|
staticprivate |
Definition at line 53 of file ThreadedExecutor.cpp.
|
private |
Definition at line 57 of file ThreadedExecutor.cpp.
References controlc_, controlm_, controls_, and folly::with_unique_lock().
Referenced by add(), work(), and ~ThreadedExecutor().
|
delete |
|
delete |
|
private |
Definition at line 78 of file ThreadedExecutor.cpp.
References finished_, finishedm_, notify(), and folly::with_unique_lock().
Referenced by controlLaunchEnqueuedTasks().
|
private |
Definition at line 86 of file ThreadedExecutor.h.
Referenced by controlWait(), and notify().
|
private |
Definition at line 85 of file ThreadedExecutor.h.
Referenced by controlWait(), and notify().
|
private |
Definition at line 87 of file ThreadedExecutor.h.
Referenced by controlWait(), and notify().
|
private |
Definition at line 88 of file ThreadedExecutor.h.
Referenced by ThreadedExecutor(), and ~ThreadedExecutor().
|
private |
Definition at line 91 of file ThreadedExecutor.h.
Referenced by add(), and controlLaunchEnqueuedTasks().
|
private |
Definition at line 90 of file ThreadedExecutor.h.
Referenced by add(), and controlLaunchEnqueuedTasks().
|
private |
Definition at line 97 of file ThreadedExecutor.h.
Referenced by controlJoinFinishedThreads(), work(), and ~ThreadedExecutor().
|
private |
Definition at line 96 of file ThreadedExecutor.h.
Referenced by controlJoinFinishedThreads(), and work().
|
private |
Definition at line 94 of file ThreadedExecutor.h.
Referenced by controlJoinFinishedThreads(), controlLaunchEnqueuedTasks(), controlPerformAll(), and ~ThreadedExecutor().
|
private |
Definition at line 83 of file ThreadedExecutor.h.
Referenced by add(), controlPerformAll(), and ~ThreadedExecutor().
|
private |
Definition at line 81 of file ThreadedExecutor.h.
Referenced by controlLaunchEnqueuedTasks().