Commit 33191ca3 authored by James Sedgwick's avatar James Sedgwick Committed by Sara Golemon

wangle::getEventBase()

Summary: this is going to be a really common pattern, so I'm providing a shortcut

Reviewed By: @fugalh

Differential Revision: D2146008
parent dce6e23d
......@@ -110,6 +110,10 @@ std::shared_ptr<IOExecutor> getIOExecutor() {
globalIOExecutorLock);
}
EventBase* getEventBase() {
return getIOExecutor()->getEventBase();
}
void setIOExecutor(std::shared_ptr<IOExecutor> executor) {
setExecutor(
std::move(executor),
......
......@@ -39,6 +39,9 @@ void setCPUExecutor(std::shared_ptr<Executor> executor);
// one or more EventBases.
std::shared_ptr<IOExecutor> getIOExecutor();
// Retrieve an event base from the global IOExecutor
EventBase* getEventBase();
// Set an IOExecutor to be the global IOExecutor which will be returned by
// subsequent calls to getIOExecutor(). Takes a non-owning (weak) reference.
void setIOExecutor(std::shared_ptr<IOExecutor> executor);
......
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