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 6ea6bdc..d3eab70 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 9a5664b..c92e051 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.
    *