Commit 489524aa authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook Github Bot

Make FunctionLoopCallback available outside of EventBase.cpp

Reviewed By: yfeldblum

Differential Revision: D4331194

fbshipit-source-id: 1e1579e3b775b1b4e329aa28aae11a2b54294697
parent 4092256e
......@@ -29,25 +29,6 @@
#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 {
/*
......
......@@ -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.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment