diff options
Diffstat (limited to 'src/event/IdleMonitor.cxx')
-rw-r--r-- | src/event/IdleMonitor.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/event/IdleMonitor.cxx b/src/event/IdleMonitor.cxx index c99c66b26..45f533e3f 100644 --- a/src/event/IdleMonitor.cxx +++ b/src/event/IdleMonitor.cxx @@ -21,6 +21,8 @@ #include "IdleMonitor.hxx" #include "Loop.hxx" +#include <assert.h> + void IdleMonitor::Cancel() { @@ -29,10 +31,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 +50,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 +64,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 +76,7 @@ IdleMonitor::Run() OnIdle(); } -#ifndef USE_EPOLL +#ifdef USE_GLIB_EVENTLOOP gboolean IdleMonitor::Callback(gpointer data) |