aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/IdleMonitor.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/IdleMonitor.hxx')
-rw-r--r--src/event/IdleMonitor.hxx38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/event/IdleMonitor.hxx b/src/event/IdleMonitor.hxx
index c8e79eb1d..8d4d2681a 100644
--- a/src/event/IdleMonitor.hxx
+++ b/src/event/IdleMonitor.hxx
@@ -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
@@ -22,41 +22,34 @@
#include "check.h"
-#ifndef USE_EPOLL
-#include <glib.h>
-#endif
-
class EventLoop;
/**
* An event that runs when the EventLoop has become idle, before
- * waiting for more events. This class is not thread-safe; all
- * methods must be run from EventLoop's thread.
+ * waiting for more events.
+ *
+ * This class is not thread-safe, all methods must be called from the
+ * thread that runs the #EventLoop, except where explicitly documented
+ * as thread-safe.
*/
class IdleMonitor {
-#ifdef USE_EPOLL
friend class EventLoop;
-#endif
EventLoop &loop;
-#ifdef USE_EPOLL
bool active;
-#else
- guint source_id;
-#endif
public:
-#ifdef USE_EPOLL
IdleMonitor(EventLoop &_loop)
:loop(_loop), active(false) {}
-#else
- IdleMonitor(EventLoop &_loop)
- :loop(_loop), source_id(0) {}
-#endif
~IdleMonitor() {
- Cancel();
+#ifndef NDEBUG
+ /* this check is redundant, it is only here to avoid
+ the assertion in Cancel() */
+ if (IsActive())
+#endif
+ Cancel();
}
EventLoop &GetEventLoop() const {
@@ -64,11 +57,7 @@ public:
}
bool IsActive() const {
-#ifdef USE_EPOLL
return active;
-#else
- return source_id != 0;
-#endif
}
void Schedule();
@@ -79,9 +68,6 @@ protected:
private:
void Run();
-#ifndef USE_EPOLL
- static gboolean Callback(gpointer data);
-#endif
};
#endif /* MAIN_NOTIFY_H */