diff options
Diffstat (limited to 'src/event/Loop.cxx')
-rw-r--r-- | src/event/Loop.cxx | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index 57c966bb7..8c8ac9993 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -217,15 +217,9 @@ EventLoop::RemoveDeferred(DeferredMonitor &d) deferred.erase(i); } -bool -EventLoop::OnSocketReady(gcc_unused unsigned flags) +void +EventLoop::HandleDeferred() { - assert(!quit); - - wake_fd.Read(); - - mutex.lock(); - while (!deferred.empty() && !quit) { DeferredMonitor &m = *deferred.front(); assert(m.pending); @@ -237,7 +231,17 @@ EventLoop::OnSocketReady(gcc_unused unsigned flags) m.RunDeferred(); mutex.lock(); } +} +bool +EventLoop::OnSocketReady(gcc_unused unsigned flags) +{ + assert(!quit); + + wake_fd.Read(); + + mutex.lock(); + HandleDeferred(); mutex.unlock(); return true; |