aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/TimeoutMonitor.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/TimeoutMonitor.hxx')
-rw-r--r--src/event/TimeoutMonitor.hxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/event/TimeoutMonitor.hxx b/src/event/TimeoutMonitor.hxx
index b0550933e..98e4e5564 100644
--- a/src/event/TimeoutMonitor.hxx
+++ b/src/event/TimeoutMonitor.hxx
@@ -22,17 +22,34 @@
#include "check.h"
+#ifndef USE_EPOLL
#include <glib.h>
+#endif
class EventLoop;
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();
@@ -43,7 +60,11 @@ public:
}
bool IsActive() const {
+#ifdef USE_EPOLL
+ return active;
+#else
return source != nullptr;
+#endif
}
void Schedule(unsigned ms);
@@ -55,7 +76,10 @@ protected:
private:
void Run();
+
+#ifndef USE_EPOLL
static gboolean Callback(gpointer data);
+#endif
};
#endif /* MAIN_NOTIFY_H */