diff --git a/src/event/MaskMonitor.cxx b/src/event/MaskMonitor.cxx index c22ba36e2..d69329b1d 100644 --- a/src/event/MaskMonitor.cxx +++ b/src/event/MaskMonitor.cxx @@ -24,11 +24,11 @@ void MaskMonitor::OrMask(unsigned new_mask) { if (pending_mask.fetch_or(new_mask) == 0) - DeferredMonitor::Schedule(); + defer.Schedule(); } void -MaskMonitor::RunDeferred() +MaskMonitor::RunDeferred() noexcept { const unsigned mask = pending_mask.exchange(0); if (mask != 0) diff --git a/src/event/MaskMonitor.hxx b/src/event/MaskMonitor.hxx index a754c4a81..5f2352983 100644 --- a/src/event/MaskMonitor.hxx +++ b/src/event/MaskMonitor.hxx @@ -21,7 +21,7 @@ #define MPD_EVENT_MASK_MONITOR_HXX #include "check.h" -#include "DeferredMonitor.hxx" +#include "DeferEvent.hxx" #include "util/BindMethod.hxx" #include @@ -32,7 +32,9 @@ * * This class is thread-safe. */ -class MaskMonitor final : DeferredMonitor { +class MaskMonitor final { + DeferEvent defer; + typedef BoundMethod Callback; const Callback callback; @@ -40,16 +42,22 @@ class MaskMonitor final : DeferredMonitor { public: MaskMonitor(EventLoop &_loop, Callback _callback) - :DeferredMonitor(_loop), callback(_callback), pending_mask(0) {} + :defer(_loop, BIND_THIS_METHOD(RunDeferred)), + callback(_callback), pending_mask(0) {} - using DeferredMonitor::GetEventLoop; - using DeferredMonitor::Cancel; + EventLoop &GetEventLoop() { + return defer.GetEventLoop(); + } + + void Cancel() { + defer.Cancel(); + } void OrMask(unsigned new_mask); protected: - /* virtual methode from class DeferredMonitor */ - void RunDeferred() override; + /* DeferEvent callback */ + void RunDeferred() noexcept; }; #endif