diff options
Diffstat (limited to 'src/event/DeferredMonitor.cxx')
-rw-r--r-- | src/event/DeferredMonitor.cxx | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/src/event/DeferredMonitor.cxx b/src/event/DeferredMonitor.cxx index 4ffffaa89..ef7a98911 100644 --- a/src/event/DeferredMonitor.cxx +++ b/src/event/DeferredMonitor.cxx @@ -24,58 +24,11 @@ void DeferredMonitor::Cancel() { -#ifdef USE_EPOLL - pending = false; -#else - const auto id = source_id.exchange(0); - if (id != 0) - g_source_remove(id); -#endif + loop.RemoveDeferred(*this); } void DeferredMonitor::Schedule() { -#ifdef USE_EPOLL - if (!pending.exchange(true)) - fd.Write(); -#else - const unsigned id = loop.AddIdle(Callback, this); - const auto old_id = source_id.exchange(id); - if (old_id != 0) - g_source_remove(old_id); -#endif + loop.AddDeferred(*this); } - -#ifdef USE_EPOLL - -bool -DeferredMonitor::OnSocketReady(unsigned) -{ - fd.Read(); - - if (pending.exchange(false)) - RunDeferred(); - - return true; -} - -#else - -void -DeferredMonitor::Run() -{ - const auto id = source_id.exchange(0); - if (id != 0) - RunDeferred(); -} - -gboolean -DeferredMonitor::Callback(gpointer data) -{ - DeferredMonitor &monitor = *(DeferredMonitor *)data; - monitor.Run(); - return false; -} - -#endif |