Use singleton EventBasePool in ServiceRouter
authorAndrii Grynenko <andrii@fb.com>
Thu, 1 Dec 2016 01:59:58 +0000 (17:59 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Thu, 1 Dec 2016 02:08:46 +0000 (18:08 -0800)
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

index c26f92cf6009f934d6a2587cf1c3b7d3630a78c8..e18cffd4db2efcee3a7a3f98d927a29a61605166 100644 (file)
@@ -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;