Commit 1cd90b1d authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook Github Bot 3

Remove runAfterDrain()

Reviewed By: djwatson

Differential Revision: D3832835

fbshipit-source-id: b5cabc00758fd80b314424e4224458e2d50ddb5c
parent 83b4f372
...@@ -236,12 +236,6 @@ EventBase::~EventBase() { ...@@ -236,12 +236,6 @@ EventBase::~EventBase() {
event_base_free(evb_); event_base_free(evb_);
} }
while (!runAfterDrainCallbacks_.empty()) {
LoopCallback* callback = &runAfterDrainCallbacks_.front();
runAfterDrainCallbacks_.pop_front();
callback->runLoopCallback();
}
{ {
std::lock_guard<std::mutex> lock(localStorageMutex_); std::lock_guard<std::mutex> lock(localStorageMutex_);
for (auto storage : localStorageToDtor_) { for (auto storage : localStorageToDtor_) {
...@@ -549,13 +543,6 @@ void EventBase::runInLoop(Func cob, bool thisIteration) { ...@@ -549,13 +543,6 @@ void EventBase::runInLoop(Func cob, bool thisIteration) {
} }
} }
void EventBase::runAfterDrain(Func cob) {
auto callback = new FunctionLoopCallback(std::move(cob));
std::lock_guard<std::mutex> lg(runAfterDrainCallbacksMutex_);
callback->cancelLoopCallback();
runAfterDrainCallbacks_.push_back(*callback);
}
void EventBase::runOnDestruction(LoopCallback* callback) { void EventBase::runOnDestruction(LoopCallback* callback) {
std::lock_guard<std::mutex> lg(onDestructionCallbacksMutex_); std::lock_guard<std::mutex> lg(onDestructionCallbacksMutex_);
callback->cancelLoopCallback(); callback->cancelLoopCallback();
......
...@@ -318,15 +318,6 @@ class EventBase : private boost::noncopyable, ...@@ -318,15 +318,6 @@ class EventBase : private boost::noncopyable,
*/ */
void runOnDestruction(LoopCallback* callback); void runOnDestruction(LoopCallback* callback);
/**
* Adds the given callback to a queue of things run after the notification
* queue is drained before the destruction of current EventBase.
*
* Note: will be called from the thread that invoked EventBase destructor,
* after the final run of loop callbacks.
*/
void runAfterDrain(Func cob);
/** /**
* Adds a callback that will run immediately *before* the event loop. * Adds a callback that will run immediately *before* the event loop.
* This is very similar to runInLoop(), but will not cause the loop to break: * This is very similar to runInLoop(), but will not cause the loop to break:
...@@ -677,7 +668,6 @@ class EventBase : private boost::noncopyable, ...@@ -677,7 +668,6 @@ class EventBase : private boost::noncopyable,
LoopCallbackList loopCallbacks_; LoopCallbackList loopCallbacks_;
LoopCallbackList runBeforeLoopCallbacks_; LoopCallbackList runBeforeLoopCallbacks_;
LoopCallbackList onDestructionCallbacks_; LoopCallbackList onDestructionCallbacks_;
LoopCallbackList runAfterDrainCallbacks_;
// This will be null most of the time, but point to currentCallbacks // This will be null most of the time, but point to currentCallbacks
// if we are in the middle of running loop callbacks, such that // if we are in the middle of running loop callbacks, such that
...@@ -752,9 +742,6 @@ class EventBase : private boost::noncopyable, ...@@ -752,9 +742,6 @@ class EventBase : private boost::noncopyable,
// allow runOnDestruction() to be called from any threads // allow runOnDestruction() to be called from any threads
std::mutex onDestructionCallbacksMutex_; std::mutex onDestructionCallbacksMutex_;
// allow runAfterDrain() to be called from any threads
std::mutex runAfterDrainCallbacksMutex_;
// see EventBaseLocal // see EventBaseLocal
friend class detail::EventBaseLocalBase; friend class detail::EventBaseLocalBase;
template <typename T> friend class EventBaseLocal; template <typename T> friend class EventBaseLocal;
......
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