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.cxx37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/event/TimeoutMonitor.cxx b/src/event/TimeoutMonitor.cxx
index 3d7d46324..55260af2a 100644
--- a/src/event/TimeoutMonitor.cxx
+++ b/src/event/TimeoutMonitor.cxx
@@ -25,32 +25,19 @@ void
TimeoutMonitor::Cancel()
{
if (IsActive()) {
-#ifdef USE_INTERNAL_EVENTLOOP
active = false;
loop.CancelTimer(*this);
-#endif
-
-#ifdef USE_GLIB_EVENTLOOP
- g_source_destroy(source);
- g_source_unref(source);
- source = nullptr;
-#endif
}
}
void
+
TimeoutMonitor::Schedule(unsigned ms)
{
Cancel();
-#ifdef USE_INTERNAL_EVENTLOOP
active = true;
loop.AddTimer(*this, ms);
-#endif
-
-#ifdef USE_GLIB_EVENTLOOP
- source = loop.AddTimeout(ms, Callback, this);
-#endif
}
void
@@ -58,33 +45,11 @@ TimeoutMonitor::ScheduleSeconds(unsigned s)
{
Cancel();
-#ifdef USE_INTERNAL_EVENTLOOP
Schedule(s * 1000u);
-#endif
-
-#ifdef USE_GLIB_EVENTLOOP
- source = loop.AddTimeoutSeconds(s, Callback, this);
-#endif
}
void
TimeoutMonitor::Run()
{
-#ifdef USE_GLIB_EVENTLOOP
- Cancel();
-#endif
-
OnTimeout();
}
-
-#ifdef USE_GLIB_EVENTLOOP
-
-gboolean
-TimeoutMonitor::Callback(gpointer data)
-{
- TimeoutMonitor &monitor = *(TimeoutMonitor *)data;
- monitor.Run();
- return false;
-}
-
-#endif