This is an automated email from the ASF dual-hosted git repository. bmahler pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 5b53a099c02c3cd4647b3e0d01a6e1613fba28a0 Author: Benjamin Mahler <bmah...@apache.org> AuthorDate: Tue Jan 5 15:12:30 2021 -0500 Removed unused io watcher queue from libev.cpp. The TODO removed in this change was implemented long ago, and hence the io watchers queue is no longer used. Review: https://reviews.apache.org/r/73135 --- 3rdparty/libprocess/src/posix/libev/libev.cpp | 13 ++----------- 3rdparty/libprocess/src/posix/libev/libev.hpp | 10 ++-------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/3rdparty/libprocess/src/posix/libev/libev.cpp b/3rdparty/libprocess/src/posix/libev/libev.cpp index b38e7a0..b1ff3d4 100644 --- a/3rdparty/libprocess/src/posix/libev/libev.cpp +++ b/3rdparty/libprocess/src/posix/libev/libev.cpp @@ -33,9 +33,7 @@ ev_async shutdown_watcher; // libev.hpp (since these need to live in the static data space). struct ev_loop* loop = nullptr; -std::queue<ev_io*>* watchers = new std::queue<ev_io*>(); - -std::mutex* watchers_mutex = new std::mutex(); +std::mutex* functions_mutex = new std::mutex(); std::queue<lambda::function<void()>>* functions = new std::queue<lambda::function<void()>>(); @@ -46,14 +44,7 @@ thread_local bool* _in_event_loop_ = nullptr; void handle_async(struct ev_loop* loop, ev_async* _, int revents) { std::queue<lambda::function<void()>> run_functions; - synchronized (watchers_mutex) { - // Start all the new I/O watchers. - while (!watchers->empty()) { - ev_io* watcher = watchers->front(); - watchers->pop(); - ev_io_start(loop, watcher); - } - + synchronized (functions_mutex) { // Swap the functions into a temporary queue so that we can invoke // them outside of the mutex. std::swap(run_functions, *functions); diff --git a/3rdparty/libprocess/src/posix/libev/libev.hpp b/3rdparty/libprocess/src/posix/libev/libev.hpp index d451931..739f634 100644 --- a/3rdparty/libprocess/src/posix/libev/libev.hpp +++ b/3rdparty/libprocess/src/posix/libev/libev.hpp @@ -33,15 +33,9 @@ extern struct ev_loop* loop; // with IO watchers and functions (via run_in_event_loop). extern ev_async async_watcher; -// Queue of I/O watchers to be asynchronously added to the event loop -// (protected by 'watchers' below). -// TODO(benh): Replace this queue with functions that we put in -// 'functions' below that perform the ev_io_start themselves. -extern std::queue<ev_io*>* watchers; -extern std::mutex* watchers_mutex; - // Queue of functions to be invoked asynchronously within the vent // loop (protected by 'watchers' above). +extern std::mutex* functions_mutex; extern std::queue<lambda::function<void()>>* functions; // Per thread bool pointer. We use a pointer to lazily construct the @@ -81,7 +75,7 @@ Future<T> run_in_event_loop(const lambda::function<Future<T>()>& f) Future<T> future = promise->future(); // Enqueue the function. - synchronized (watchers_mutex) { + synchronized (functions_mutex) { functions->push(lambda::bind(&_run_in_event_loop<T>, f, promise)); }