Skip to content

Commit

Permalink
Don't mask processing events unless there is a task to run
Browse files Browse the repository at this point in the history
  • Loading branch information
Bidski committed Oct 9, 2023
1 parent dcafa44 commit 11fa194
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/extension/IOController_Posix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<threading::ReactionTask> 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 {
Expand Down

0 comments on commit 11fa194

Please sign in to comment.