From bf3ced6a341ab8ca11357e94d7da8f7a41069c40 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 12 Nov 2017 17:32:23 +0100 Subject: [PATCH] event/Call: migrate from DeferredMonitor to DeferEvent --- src/event/Call.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/event/Call.cxx b/src/event/Call.cxx index f3eb82235..938ce70bb 100644 --- a/src/event/Call.cxx +++ b/src/event/Call.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "Call.hxx" #include "Loop.hxx" -#include "DeferredMonitor.hxx" +#include "DeferEvent.hxx" #include "thread/Mutex.hxx" #include "thread/Cond.hxx" #include "Compiler.h" @@ -30,8 +30,9 @@ #include class BlockingCallMonitor final - : DeferredMonitor { + DeferEvent defer_event; + const std::function f; Mutex mutex; @@ -43,12 +44,13 @@ class BlockingCallMonitor final public: BlockingCallMonitor(EventLoop &_loop, std::function &&_f) - :DeferredMonitor(_loop), f(std::move(_f)), done(false) {} + :defer_event(_loop, BIND_THIS_METHOD(RunDeferred)), + f(std::move(_f)), done(false) {} void Run() { assert(!done); - Schedule(); + defer_event.Schedule(); mutex.lock(); while (!done) @@ -60,7 +62,7 @@ public: } private: - virtual void RunDeferred() override { + void RunDeferred() noexcept { assert(!done); try {