Commit da9e5849 authored by Max Kellermann's avatar Max Kellermann

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

Reduce DeferredMonitor overhead.
parent e9d764d7
......@@ -207,10 +207,15 @@ 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();
if (must_wake)
wake_fd.Write();
}
......
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