aboutsummaryrefslogtreecommitdiffstats
path: root/src/event/TimeoutMonitor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/event/TimeoutMonitor.cxx')
-rw-r--r--src/event/TimeoutMonitor.cxx33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/event/TimeoutMonitor.cxx b/src/event/TimeoutMonitor.cxx
index cffad6b92..e04af3e4e 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,31 +45,11 @@ TimeoutMonitor::ScheduleSeconds(unsigned s)
{
Cancel();
-#ifdef USE_EPOLL
Schedule(s * 1000u);
-#else
- source = loop.AddTimeoutSeconds(s, Callback, this);
-#endif
}
void
TimeoutMonitor::Run()
{
-#ifndef USE_EPOLL
- Cancel();
-#endif
-
OnTimeout();
}
-
-#ifndef USE_EPOLL
-
-gboolean
-TimeoutMonitor::Callback(gpointer data)
-{
- TimeoutMonitor &monitor = *(TimeoutMonitor *)data;
- monitor.Run();
- return false;
-}
-
-#endif