From 11fa194d9aabee03e8f0b3f739a08fbe2cf3b1f2 Mon Sep 17 00:00:00 2001 From: Alex Biddulph Date: Mon, 9 Oct 2023 11:05:56 +1100 Subject: [PATCH] Don't mask processing events unless there is a task to run --- src/extension/IOController_Posix.hpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/extension/IOController_Posix.hpp b/src/extension/IOController_Posix.hpp index 4079b522..ca52cc42 100644 --- a/src/extension/IOController_Posix.hpp +++ b/src/extension/IOController_Posix.hpp @@ -125,25 +125,25 @@ namespace extension { e.fd = task.fd; e.events = task.waiting_events; - // Clear the waiting events, we are now processing them - task.processing_events = task.waiting_events; - task.waiting_events = 0; - - // Mask out the currently processing events so poll doesn't notify for them - auto it = - std::lower_bound(watches.begin(), watches.end(), task.fd, [&](const pollfd& w, const fd_t& fd) { - return w.fd < fd; - }); - if (it != watches.end() && it->fd == task.fd) { - it->events = event_t(it->events & ~task.processing_events); - } - // Submit the task (which should run the get) IO::ThreadEventStore::value = &e; std::unique_ptr r = task.reaction->get_task(); IO::ThreadEventStore::value = nullptr; if (r != nullptr) { + // Clear the waiting events, we are now processing them + task.processing_events = task.waiting_events; + task.waiting_events = 0; + + // Mask out the currently processing events so poll doesn't notify for them + auto it = + std::lower_bound(watches.begin(), watches.end(), task.fd, [&](const pollfd& w, const fd_t& fd) { + return w.fd < fd; + }); + if (it != watches.end() && it->fd == task.fd) { + it->events = event_t(it->events & ~task.processing_events); + } + powerplant.submit(std::move(r)); } else {