diff options
Diffstat (limited to '')
-rw-r--r-- | src/event/TimeoutMonitor.hxx | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/event/TimeoutMonitor.hxx b/src/event/TimeoutMonitor.hxx index 98e4e5564..414d48aa6 100644 --- a/src/event/TimeoutMonitor.hxx +++ b/src/event/TimeoutMonitor.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,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 */ |