allow fiber executor to override fiber options
authorDavid Goode <dgoode@fb.com>
Sat, 2 Dec 2017 03:56:14 +0000 (19:56 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 2 Dec 2017 04:05:44 +0000 (20:05 -0800)
Summary: As in title, for eg larger stack size

Reviewed By: yfeldblum

Differential Revision: D6466762

fbshipit-source-id: 303e8732c8bfb64fbd8619163779942fe5f8b5a8

folly/executors/FiberIOExecutor.h

index 18c361811634fd5d8aa9b800effddbf25e162efa..240d7d47b8f00f0afadd58dd084f3073442cd990 100644 (file)
@@ -30,12 +30,14 @@ namespace folly {
  */
 class FiberIOExecutor : public IOExecutor {
  public:
-  explicit FiberIOExecutor(const std::shared_ptr<IOExecutor>& ioExecutor)
-      : ioExecutor_(ioExecutor) {}
+  explicit FiberIOExecutor(
+      const std::shared_ptr<IOExecutor>& ioExecutor,
+      fibers::FiberManager::Options opts = fibers::FiberManager::Options())
+      : ioExecutor_(ioExecutor), options_(std::move(opts)) {}
 
   virtual void add(folly::Function<void()> f) override {
     auto eventBase = ioExecutor_->getEventBase();
-    folly::fibers::getFiberManager(*eventBase).add(std::move(f));
+    folly::fibers::getFiberManager(*eventBase, options_).add(std::move(f));
   }
 
   virtual folly::EventBase* getEventBase() override {
@@ -44,6 +46,7 @@ class FiberIOExecutor : public IOExecutor {
 
  private:
   std::shared_ptr<IOExecutor> ioExecutor_;
+  fibers::FiberManager::Options options_;
 };
 
 } // namespace folly