From 930da0547264c17739050ec0e9fad39887e78bab Mon Sep 17 00:00:00 2001 From: Andrii Grynenko Date: Wed, 30 Nov 2016 17:59:58 -0800 Subject: [PATCH] Use singleton EventBasePool in ServiceRouter Summary: Switching ServiceRouter code to use VirtualEventBase instead of EventBase allows us to have same thread-pool shared between multiple ServiceRouter instances. In future this allows us to replace EventBasePoolImpl with some generic thread-pool implementation (e.g. IOThreadPoolExecutor). It also makes it trivial to have ServiceRouter run on a any existing thread-pool if necessary. Reviewed By: smichelson Differential Revision: D3935283 fbshipit-source-id: 3275bbace15a0df8b06d12c970ccc098a631658d --- folly/io/async/VirtualEventBase.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/folly/io/async/VirtualEventBase.h b/folly/io/async/VirtualEventBase.h index c26f92cf..e18cffd4 100644 --- a/folly/io/async/VirtualEventBase.h +++ b/folly/io/async/VirtualEventBase.h @@ -155,6 +155,10 @@ class VirtualEventBase : public folly::Executor, public folly::TimeoutManager { return LoopKeepAlive(this); } + bool inRunningEventBaseThread() const { + return evb_.inRunningEventBaseThread(); + } + private: using LoopCallbackList = EventBase::LoopCallback::List; -- 2.34.1