diff options
author | Max Kellermann <max@duempel.org> | 2014-01-04 15:48:57 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-04 15:58:59 +0100 |
commit | d2a4f64fd605d7192f62977376c0928cef3a1efc (patch) | |
tree | 686e54437add5568564707883e4f23ed991adcac | |
parent | a357d84dce668d126fe984680e5d17f6d41b2fe6 (diff) | |
download | mpd-d2a4f64fd605d7192f62977376c0928cef3a1efc.tar.gz mpd-d2a4f64fd605d7192f62977376c0928cef3a1efc.tar.xz mpd-d2a4f64fd605d7192f62977376c0928cef3a1efc.zip |
event/BlockingCall: always use DeferredMonitor internally
There is no advantage of using EventLoop::AddCall(), now that
DeferredMonitor is thread-safe.
-rw-r--r-- | src/event/Call.cxx | 24 |
1 files changed, 0 insertions, 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 <assert.h> class BlockingCallMonitor final -#ifdef USE_GLIB_EVENTLOOP : DeferredMonitor -#endif { const std::function<void()> f; @@ -40,26 +38,13 @@ class BlockingCallMonitor final bool done; public: -#ifdef USE_INTERNAL_EVENTLOOP - BlockingCallMonitor(EventLoop &loop, std::function<void()> &&_f) - :f(std::move(_f)), done(false) { - loop.AddCall([this](){ - this->DoRun(); - }); - } -#endif - -#ifdef USE_GLIB_EVENTLOOP BlockingCallMonitor(EventLoop &_loop, std::function<void()> &&_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(); |