From 1cd90b1d14daac0ab0d48eda5677ba97998de99b Mon Sep 17 00:00:00 2001 From: Andrii Grynenko Date: Thu, 8 Sep 2016 10:29:01 -0700 Subject: [PATCH] Remove runAfterDrain() Reviewed By: djwatson Differential Revision: D3832835 fbshipit-source-id: b5cabc00758fd80b314424e4224458e2d50ddb5c --- folly/io/async/EventBase.cpp | 13 ------------- folly/io/async/EventBase.h | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/folly/io/async/EventBase.cpp b/folly/io/async/EventBase.cpp index e250c364..a4cbfa20 100644 --- a/folly/io/async/EventBase.cpp +++ b/folly/io/async/EventBase.cpp @@ -236,12 +236,6 @@ EventBase::~EventBase() { event_base_free(evb_); } - while (!runAfterDrainCallbacks_.empty()) { - LoopCallback* callback = &runAfterDrainCallbacks_.front(); - runAfterDrainCallbacks_.pop_front(); - callback->runLoopCallback(); - } - { std::lock_guard lock(localStorageMutex_); for (auto storage : localStorageToDtor_) { @@ -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 lg(runAfterDrainCallbacksMutex_); - callback->cancelLoopCallback(); - runAfterDrainCallbacks_.push_back(*callback); -} - void EventBase::runOnDestruction(LoopCallback* callback) { std::lock_guard lg(onDestructionCallbacksMutex_); callback->cancelLoopCallback(); diff --git a/folly/io/async/EventBase.h b/folly/io/async/EventBase.h index 7f8aaeb8..16d406ea 100644 --- a/folly/io/async/EventBase.h +++ b/folly/io/async/EventBase.h @@ -318,15 +318,6 @@ class EventBase : private boost::noncopyable, */ 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. * This is very similar to runInLoop(), but will not cause the loop to break: @@ -677,7 +668,6 @@ class EventBase : private boost::noncopyable, LoopCallbackList loopCallbacks_; LoopCallbackList runBeforeLoopCallbacks_; LoopCallbackList onDestructionCallbacks_; - LoopCallbackList runAfterDrainCallbacks_; // This will be null most of the time, but point to currentCallbacks // if we are in the middle of running loop callbacks, such that @@ -752,9 +742,6 @@ class EventBase : private boost::noncopyable, // allow runOnDestruction() to be called from any threads std::mutex onDestructionCallbacksMutex_; - // allow runAfterDrain() to be called from any threads - std::mutex runAfterDrainCallbacksMutex_; - // see EventBaseLocal friend class detail::EventBaseLocalBase; template friend class EventBaseLocal; -- 2.34.1