diff options
author | Max Kellermann <max@duempel.org> | 2014-01-05 01:37:22 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-05 02:15:34 +0100 |
commit | e599b86424014d469874f67594112e0a7160a336 (patch) | |
tree | 0cda94c849fe2f4d06dba600a4cf452c87c8d576 /src/event/Loop.hxx | |
parent | da9e5849212337f26d1fa0450ce71cd58aefc30d (diff) | |
download | mpd-e599b86424014d469874f67594112e0a7160a336.tar.gz mpd-e599b86424014d469874f67594112e0a7160a336.tar.xz mpd-e599b86424014d469874f67594112e0a7160a336.zip |
event/Loop: try to avoid the WakeFD when adding DeferredMonitor
Add a flag that indicates whether the EventLoop is currently "busy".
As long as that flag is set, it does not need to be woken up - we can
simply add the DeferredMonitor to the list, and it will be caught by
EventLoop very soon. This eliminates nearly all of the
DeferredMonitor overhead when compared to IdleMonitor, rendering
IdleMonitor mostly obsolete.
Diffstat (limited to 'src/event/Loop.hxx')
-rw-r--r-- | src/event/Loop.hxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index bfa8dc4a9..4bd2a3b2c 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -90,6 +90,14 @@ class EventLoop final : SocketMonitor */ bool again; + /** + * True when handling callbacks, false when waiting for I/O or + * timeout. + * + * Protected with #mutex. + */ + bool busy; + PollGroup poll_group; PollResult poll_result; |