diff --git a/folly/wangle/concurrent/GlobalExecutor.cpp b/folly/wangle/concurrent/GlobalExecutor.cpp index 36a82155ee1252a29111d05b8cd5f1464692c307..9d6aca40066610c5baf61262b67637ab9952303b 100644 --- a/folly/wangle/concurrent/GlobalExecutor.cpp +++ b/folly/wangle/concurrent/GlobalExecutor.cpp @@ -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), diff --git a/folly/wangle/concurrent/GlobalExecutor.h b/folly/wangle/concurrent/GlobalExecutor.h index fa7d06c6d5f0fd923d090a8f3a317a2029b9e618..d85b180db8aab0d88c6e33c849fc77774d13311d 100644 --- a/folly/wangle/concurrent/GlobalExecutor.h +++ b/folly/wangle/concurrent/GlobalExecutor.h @@ -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);