aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/Loop.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-05 01:37:22 +0100
committerMax Kellermann <max@duempel.org>2014-01-05 02:15:34 +0100
commite599b86424014d469874f67594112e0a7160a336 (patch)
tree0cda94c849fe2f4d06dba600a4cf452c87c8d576 /src/event/Loop.hxx
parentda9e5849212337f26d1fa0450ce71cd58aefc30d (diff)
downloadmpd-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.hxx8
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;