Make FunctionLoopCallback available outside of EventBase.cpp
authorAndrii Grynenko <andrii@fb.com>
Thu, 15 Dec 2016 04:03:18 +0000 (20:03 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 15 Dec 2016 04:18:11 +0000 (20:18 -0800)
Reviewed By: yfeldblum

Differential Revision: D4331194

fbshipit-source-id: 1e1579e3b775b1b4e329aa28aae11a2b54294697

folly/io/async/EventBase.cpp
folly/io/async/EventBase.h

index 6ea6bdc94b2b71611cd3a01c8e55255fee5bef6e..d3eab70c4fa303b62276967474953b3295ae762f 100644 (file)
 #include <mutex>
 #include <pthread.h>
 
-namespace {
-
-using folly::EventBase;
-
-class FunctionLoopCallback : public EventBase::LoopCallback {
- public:
-  explicit FunctionLoopCallback(EventBase::Func&& function)
-      : function_(std::move(function)) {}
-
-  void runLoopCallback() noexcept override {
-    function_();
-    delete this;
-  }
-
- private:
-  EventBase::Func function_;
-};
-}
-
 namespace folly {
 
 /*
index 9a5664bc559484ea20565202d82fea0d1fc4a1e8..c92e05170fa4b58077b5ba9e81f88c84ed0684e7 100644 (file)
@@ -165,6 +165,20 @@ class EventBase : private boost::noncopyable,
     std::shared_ptr<RequestContext> context_;
   };
 
+  class FunctionLoopCallback : public LoopCallback {
+   public:
+    explicit FunctionLoopCallback(Func&& function)
+        : function_(std::move(function)) {}
+
+    void runLoopCallback() noexcept override {
+      function_();
+      delete this;
+    }
+
+   private:
+    Func function_;
+  };
+
   /**
    * Create a new EventBase object.
    *