proxygen
|
#include <ScopedEventBaseThread.h>
Public Member Functions | |
ScopedEventBaseThread () | |
ScopedEventBaseThread (const StringPiece &name) | |
ScopedEventBaseThread (EventBaseManager *ebm) | |
ScopedEventBaseThread (EventBaseManager *ebm, const StringPiece &name) | |
~ScopedEventBaseThread () | |
EventBase * | getEventBase () const |
EventBase * | getEventBase () override |
std::thread::id | getThreadId () const |
void | add (Func func) override |
![]() | |
~IOExecutor () override=default | |
![]() | |
virtual | ~Executor () |
virtual void | addWithPriority (Func, int8_t priority) |
virtual uint8_t | getNumPriorities () const |
Private Member Functions | |
ScopedEventBaseThread (ScopedEventBaseThread &&other)=delete | |
ScopedEventBaseThread & | operator= (ScopedEventBaseThread &&other)=delete |
ScopedEventBaseThread (const ScopedEventBaseThread &other)=delete | |
ScopedEventBaseThread & | operator= (const ScopedEventBaseThread &other)=delete |
Private Attributes | |
EventBaseManager * | ebm_ |
union { | |
EventBase eb_ | |
}; | |
std::thread | th_ |
folly::Baton | stop_ |
Additional Inherited Members | |
![]() | |
template<typename ExecutorT > | |
static KeepAlive< ExecutorT > | getKeepAliveToken (ExecutorT *executor) |
template<typename ExecutorT > | |
static KeepAlive< ExecutorT > | getKeepAliveToken (ExecutorT &executor) |
![]() | |
static const int8_t | LO_PRI = SCHAR_MIN |
static const int8_t | MID_PRI = 0 |
static const int8_t | HI_PRI = SCHAR_MAX |
![]() | |
virtual bool | keepAliveAcquire () |
virtual void | keepAliveRelease () |
![]() | |
template<typename ExecutorT > | |
static bool | isKeepAliveDummy (const KeepAlive< ExecutorT > &keepAlive) |
template<typename ExecutorT > | |
static KeepAlive< ExecutorT > | makeKeepAlive (ExecutorT *executor) |
A helper class to start a new thread running a EventBase loop.
The new thread will be started by the ScopedEventBaseThread constructor. When the ScopedEventBaseThread object is destroyed, the thread will be stopped.
Definition at line 39 of file ScopedEventBaseThread.h.
folly::ScopedEventBaseThread::ScopedEventBaseThread | ( | ) |
Definition at line 50 of file ScopedEventBaseThread.cpp.
Referenced by add().
|
explicit |
Definition at line 53 of file ScopedEventBaseThread.cpp.
|
explicit |
Definition at line 56 of file ScopedEventBaseThread.cpp.
|
explicit |
Definition at line 59 of file ScopedEventBaseThread.cpp.
References eb_, ebm_, folly::run(), stop_, th_, and folly::EventBase::waitUntilRunning().
folly::ScopedEventBaseThread::~ScopedEventBaseThread | ( | ) |
Definition at line 68 of file ScopedEventBaseThread.cpp.
References eb_, folly::Baton< MayBlock, Atom >::post(), stop_, folly::EventBase::terminateLoopSoon(), and th_.
|
privatedelete |
|
privatedelete |
|
inlineoverridevirtual |
Enqueue a function to executed by this executor. This and all variants must be threadsafe.
Implements folly::Executor.
Definition at line 61 of file ScopedEventBaseThread.h.
References folly::EventBase::add(), getEventBase(), folly::gen::move, operator=(), and ScopedEventBaseThread().
|
inline |
Definition at line 49 of file ScopedEventBaseThread.h.
References eb_.
Referenced by add(), folly::EvbAndContext::getEventBase(), QueueTest::sendOne(), folly::TEST(), TEST(), and TEST_F().
|
inlineoverridevirtual |
Implements folly::IOExecutor.
Definition at line 53 of file ScopedEventBaseThread.h.
References eb_.
|
inline |
|
privatedelete |
Referenced by add().
|
privatedelete |
union { ... } |
|
mutable |
Definition at line 74 of file ScopedEventBaseThread.h.
Referenced by getEventBase(), ScopedEventBaseThread(), and ~ScopedEventBaseThread().
|
private |
Definition at line 72 of file ScopedEventBaseThread.h.
Referenced by ScopedEventBaseThread().
|
private |
Definition at line 77 of file ScopedEventBaseThread.h.
Referenced by ScopedEventBaseThread(), and ~ScopedEventBaseThread().
|
private |
Definition at line 76 of file ScopedEventBaseThread.h.
Referenced by getThreadId(), ScopedEventBaseThread(), and ~ScopedEventBaseThread().