Commit da9e5849 authored by Max Kellermann's avatar Max Kellermann

event/Loop: combine multiple WakeFD::Write() calls

Reduce DeferredMonitor overhead.
parent e9d764d7
......@@ -207,11 +207,16 @@ EventLoop::AddDeferred(DeferredMonitor &d)
assert(std::find(deferred.begin(),
deferred.end(), &d) == deferred.end());
/* we don't need to wake up the EventLoop if another
DeferredMonitor has already done it */
const bool must_wake = deferred.empty();
d.pending = true;
deferred.push_back(&d);
mutex.unlock();
wake_fd.Write();
if (must_wake)
wake_fd.Write();
}
void
......
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