aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/TimeoutMonitor.hxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/event/TimeoutMonitor.hxx31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/event/TimeoutMonitor.hxx b/src/event/TimeoutMonitor.hxx
index 98e4e5564..0e3f4bdb7 100644
--- a/src/event/TimeoutMonitor.hxx
+++ b/src/event/TimeoutMonitor.hxx
@@ -22,34 +22,27 @@
#include "check.h"
-#ifndef USE_EPOLL
-#include <glib.h>
-#endif
-
class EventLoop;
+/**
+ * This class monitors a timeout. Use Schedule() to begin the timeout
+ * or Cancel() to cancel it.
+ *
+ * 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 TimeoutMonitor {
-#ifdef USE_EPOLL
friend class EventLoop;
-#endif
EventLoop &loop;
-#ifdef USE_EPOLL
bool active;
-#else
- GSource *source;
-#endif
public:
-#ifdef USE_EPOLL
TimeoutMonitor(EventLoop &_loop)
:loop(_loop), active(false) {
}
-#else
- TimeoutMonitor(EventLoop &_loop)
- :loop(_loop), source(nullptr) {}
-#endif
~TimeoutMonitor() {
Cancel();
@@ -60,11 +53,7 @@ public:
}
bool IsActive() const {
-#ifdef USE_EPOLL
return active;
-#else
- return source != nullptr;
-#endif
}
void Schedule(unsigned ms);
@@ -76,10 +65,6 @@ protected:
private:
void Run();
-
-#ifndef USE_EPOLL
- static gboolean Callback(gpointer data);
-#endif
};
#endif /* MAIN_NOTIFY_H */