proxygen
|
#include <RequestWorker.h>
Classes | |
class | FinishCallback |
Public Member Functions | |
RequestWorker (FinishCallback &callback, uint8_t threadId, const std::string &evbName=std::string()) | |
void | addServiceWorker (Service *service, ServiceWorker *sw) |
ServiceWorker * | getServiceWorker (Service *service) const |
void | flushStats () |
Public Member Functions inherited from proxygen::WorkerThread | |
WorkerThread (folly::EventBaseManager *ebm, const std::string &evbName=std::string()) | |
virtual | ~WorkerThread () |
void | start () |
void | stopWhenIdle () |
void | forceStop () |
void | wait () |
folly::EventBase * | getEventBase () |
std::thread::native_handle_type | getThreadNativeHandle () noexcept |
std::thread::id | getThreadId () const noexcept |
Static Public Member Functions | |
static uint64_t | nextRequestId () |
static RequestWorker * | getRequestWorker () |
Static Public Member Functions inherited from proxygen::WorkerThread | |
static WorkerThread * | getCurrentWorkerThread () |
Private Member Functions | |
void | setup () override |
void | cleanup () override |
Private Attributes | |
uint64_t | nextRequestId_ |
std::map< Service *, ServiceWorker * > | serviceWorkers_ |
FinishCallback & | callback_ |
Additional Inherited Members |
RequestWorker extends WorkerThread, and also contains a list of ServiceWorkers running in this thread.
Definition at line 25 of file RequestWorker.h.
proxygen::RequestWorker::RequestWorker | ( | FinishCallback & | callback, |
uint8_t | threadId, | ||
const std::string & | evbName = std::string() |
||
) |
Create a new RequestWorker.
proxygen | The object to notify when this worker finishes. |
threadId | A unique ID for this worker. |
evbName | The event base will ne named to this name (thread name) |
Definition at line 17 of file RequestWorker.cpp.
Referenced by proxygen::RequestWorker::FinishCallback::~FinishCallback().
|
inline |
Track the ServiceWorker objects in-use by this worker.
Definition at line 57 of file RequestWorker.h.
References serviceWorkers_.
Referenced by proxygen::Service::addServiceWorker().
|
overrideprivatevirtual |
Reimplemented from proxygen::WorkerThread.
Definition at line 40 of file RequestWorker.cpp.
References callback_, proxygen::WorkerThread::cleanup(), and proxygen::RequestWorker::FinishCallback::workerFinished().
Referenced by getServiceWorker().
void proxygen::RequestWorker::flushStats | ( | ) |
Flush any thread-local stats being tracked by our ServiceWorkers.
This must be invoked from within worker's thread.
Definition at line 28 of file RequestWorker.cpp.
References proxygen::WorkerThread::getEventBase(), and serviceWorkers_.
Referenced by getServiceWorker().
|
inlinestatic |
Definition at line 47 of file RequestWorker.h.
References proxygen::WorkerThread::getCurrentWorkerThread().
Referenced by nextRequestId().
|
inline |
For a given service, returns the ServiceWorker associated with this RequestWorker
Definition at line 66 of file RequestWorker.h.
References cleanup(), flushStats(), serviceWorkers_, and setup().
|
static |
Definition at line 24 of file RequestWorker.cpp.
References getRequestWorker(), and nextRequestId_.
Referenced by proxygen::RequestWorker::FinishCallback::~FinishCallback().
|
overrideprivatevirtual |
Reimplemented from proxygen::WorkerThread.
Definition at line 35 of file RequestWorker.cpp.
References callback_, proxygen::WorkerThread::setup(), and proxygen::RequestWorker::FinishCallback::workerStarted().
Referenced by getServiceWorker().
|
private |
Definition at line 90 of file RequestWorker.h.
|
private |
Definition at line 85 of file RequestWorker.h.
Referenced by nextRequestId().
|
private |
Definition at line 88 of file RequestWorker.h.
Referenced by addServiceWorker(), flushStats(), and getServiceWorker().