aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/IdleMonitor.cxx
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.cxx
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 '')
-rw-r--r--src/event/IdleMonitor.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/event/IdleMonitor.cxx b/src/event/IdleMonitor.cxx
index c99c66b26..8d25407b5 100644
--- a/src/event/IdleMonitor.cxx
+++ b/src/event/IdleMonitor.cxx
@@ -29,10 +29,11 @@ IdleMonitor::Cancel()
if (!IsActive())
return;
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
active = false;
loop.RemoveIdle(*this);
-#else
+#endif
+#ifdef USE_GLIB_EVENTLOOP
g_source_remove(source_id);
source_id = 0;
#endif
@@ -47,10 +48,11 @@ IdleMonitor::Schedule()
/* already scheduled */
return;
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
active = true;
loop.AddIdle(*this);
-#else
+#endif
+#ifdef USE_GLIB_EVENTLOOP
source_id = loop.AddIdle(Callback, this);
#endif
}
@@ -60,10 +62,11 @@ IdleMonitor::Run()
{
assert(loop.IsInside());
-#ifdef USE_EPOLL
+#ifdef USE_INTERNAL_EVENTLOOP
assert(active);
active = false;
-#else
+#endif
+#ifdef USE_GLIB_EVENTLOOP
assert(source_id != 0);
source_id = 0;
#endif
@@ -71,7 +74,7 @@ IdleMonitor::Run()
OnIdle();
}
-#ifndef USE_EPOLL
+#ifdef USE_GLIB_EVENTLOOP
gboolean
IdleMonitor::Callback(gpointer data)