aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/IdleMonitor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/IdleMonitor.cxx')
-rw-r--r--src/event/IdleMonitor.cxx34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/event/IdleMonitor.cxx b/src/event/IdleMonitor.cxx
index c99c66b26..4af656a22 100644
--- a/src/event/IdleMonitor.cxx
+++ b/src/event/IdleMonitor.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2013 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -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