aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/IdleMonitor.hxx
diff options
context:
space:
mode:
authorDenis Krjuchkov <denis@crazydev.net>2013-11-27 17:04:38 +0600
committerDenis Krjuchkov <denis@crazydev.net>2013-11-27 17:28:36 +0600
commit46bab7e4b921b79924643bacd08dcd3d1404ceb6 (patch)
tree2fe8e1b2185dba89d953b5d02f22cc0781e17c2c /src/event/IdleMonitor.hxx
parent22fb49fa90241abfaf5ac81de462f4b2c274f7d0 (diff)
downloadmpd-46bab7e4b921b79924643bacd08dcd3d1404ceb6.tar.gz
mpd-46bab7e4b921b79924643bacd08dcd3d1404ceb6.tar.xz
mpd-46bab7e4b921b79924643bacd08dcd3d1404ceb6.zip
Add infrastructure for using multiple event loops
This change adds two configuration options: --with-eventloop=[glib|internal|auto] --with-pollmethod=[epoll|auto] First allows switching between GLib event loop and internal one. Second chooses backend to use for internal event loop. Conditional compilation symbols are changed accordingly. Additional helper macro MPD_OPTIONAL_FUNC_NODEF is added as well.
Diffstat (limited to 'src/event/IdleMonitor.hxx')
-rw-r--r--src/event/IdleMonitor.hxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/event/IdleMonitor.hxx b/src/event/IdleMonitor.hxx
index c8e79eb1d..b040915e7 100644
--- a/src/event/IdleMonitor.hxx
+++ b/src/event/IdleMonitor.hxx
@@ -22,7 +22,7 @@
#include "check.h"
-#ifndef USE_EPOLL
+#ifdef USE_GLIB_EVENTLOOP
#include <glib.h>
#endif
@@ -34,23 +34,27 @@ class EventLoop;
* methods must be run from EventLoop's thread.
*/
class IdleMonitor {
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
friend class EventLoop;
#endif
EventLoop &loop;
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
bool active;
-#else
+#endif
+
+#ifdef USE_GLIB_EVENTLOOP
guint source_id;
#endif
public:
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
IdleMonitor(EventLoop &_loop)
:loop(_loop), active(false) {}
-#else
+#endif
+
+#ifdef USE_GLIB_EVENTLOOP
IdleMonitor(EventLoop &_loop)
:loop(_loop), source_id(0) {}
#endif
@@ -64,9 +68,11 @@ public:
}
bool IsActive() const {
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
return active;
-#else
+#endif
+
+#ifdef USE_GLIB_EVENTLOOP
return source_id != 0;
#endif
}
@@ -79,7 +85,7 @@ protected:
private:
void Run();
-#ifndef USE_EPOLL
+#ifdef USE_GLIB_EVENTLOOP
static gboolean Callback(gpointer data);
#endif
};