diff options
Diffstat (limited to 'src/event/IdleMonitor.cxx')
-rw-r--r-- | src/event/IdleMonitor.cxx | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/event/IdleMonitor.cxx b/src/event/IdleMonitor.cxx index c99c66b26..dd8d64f94 100644 --- a/src/event/IdleMonitor.cxx +++ b/src/event/IdleMonitor.cxx @@ -21,38 +21,31 @@ #include "IdleMonitor.hxx" #include "Loop.hxx" +#include <assert.h> + void IdleMonitor::Cancel() { - assert(loop.IsInside()); + assert(loop.IsInsideOrNull()); if (!IsActive()) return; -#ifdef USE_EPOLL active = false; loop.RemoveIdle(*this); -#else - g_source_remove(source_id); - source_id = 0; -#endif } void IdleMonitor::Schedule() { - assert(loop.IsInside()); + assert(loop.IsInsideOrVirgin()); if (IsActive()) /* already scheduled */ return; -#ifdef USE_EPOLL active = true; loop.AddIdle(*this); -#else - source_id = loop.AddIdle(Callback, this); -#endif } void @@ -60,25 +53,8 @@ IdleMonitor::Run() { assert(loop.IsInside()); -#ifdef USE_EPOLL assert(active); active = false; -#else - assert(source_id != 0); - source_id = 0; -#endif OnIdle(); } - -#ifndef USE_EPOLL - -gboolean -IdleMonitor::Callback(gpointer data) -{ - IdleMonitor &monitor = *(IdleMonitor *)data; - monitor.Run(); - return false; -} - -#endif |