From d2a4f64fd605d7192f62977376c0928cef3a1efc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 4 Jan 2014 15:48:57 +0100 Subject: event/BlockingCall: always use DeferredMonitor internally There is no advantage of using EventLoop::AddCall(), now that DeferredMonitor is thread-safe. --- src/event/Call.cxx | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/event/Call.cxx b/src/event/Call.cxx index 7767824f9..bc6106bf7 100644 --- a/src/event/Call.cxx +++ b/src/event/Call.cxx @@ -28,9 +28,7 @@ #include class BlockingCallMonitor final -#ifdef USE_GLIB_EVENTLOOP : DeferredMonitor -#endif { const std::function f; @@ -40,26 +38,13 @@ class BlockingCallMonitor final bool done; public: -#ifdef USE_INTERNAL_EVENTLOOP - BlockingCallMonitor(EventLoop &loop, std::function &&_f) - :f(std::move(_f)), done(false) { - loop.AddCall([this](){ - this->DoRun(); - }); - } -#endif - -#ifdef USE_GLIB_EVENTLOOP BlockingCallMonitor(EventLoop &_loop, std::function &&_f) :DeferredMonitor(_loop), f(std::move(_f)), done(false) {} -#endif void Run() { -#ifdef USE_GLIB_EVENTLOOP assert(!done); Schedule(); -#endif mutex.lock(); while (!done) @@ -67,17 +52,8 @@ public: mutex.unlock(); } -#ifdef USE_GLIB_EVENTLOOP private: virtual void RunDeferred() override { - DoRun(); - } -#endif - -#ifdef USE_INTERNAL_EVENTLOOP -public: -#endif - void DoRun() { assert(!done); f(); -- cgit v1.2.3