diff options
Diffstat (limited to '')
-rw-r--r-- | src/event/TimeoutMonitor.cxx | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/event/TimeoutMonitor.cxx b/src/event/TimeoutMonitor.cxx index 003b5b78f..007e8aa2c 100644 --- a/src/event/TimeoutMonitor.cxx +++ b/src/event/TimeoutMonitor.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 @@ -25,28 +25,19 @@ void TimeoutMonitor::Cancel() { if (IsActive()) { -#ifdef USE_EPOLL active = false; loop.CancelTimer(*this); -#else - g_source_destroy(source); - g_source_unref(source); - source = nullptr; -#endif } } void + TimeoutMonitor::Schedule(unsigned ms) { Cancel(); -#ifdef USE_EPOLL active = true; loop.AddTimer(*this, ms); -#else - source = loop.AddTimeout(ms, Callback, this); -#endif } void @@ -54,33 +45,12 @@ TimeoutMonitor::ScheduleSeconds(unsigned s) { Cancel(); -#ifdef USE_EPOLL Schedule(s * 1000u); -#else - source = loop.AddTimeoutSeconds(s, Callback, this); -#endif } void TimeoutMonitor::Run() { -#ifdef USE_EPOLL active = false; -#else - Cancel(); -#endif - OnTimeout(); } - -#ifndef USE_EPOLL - -gboolean -TimeoutMonitor::Callback(gpointer data) -{ - TimeoutMonitor &monitor = *(TimeoutMonitor *)data; - monitor.Run(); - return false; -} - -#endif |