diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-10 20:58:25 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-11-10 20:58:25 +0100 |
commit | 0db7a0c9e282b25831aacd3fc00d964ac323b074 (patch) | |
tree | e5ecd6bf1d6ba578dc0d57d2e5836b788917a3e7 /src/db/update | |
parent | 13f6b1b34477274283533d93970d93cbe4d07d5e (diff) |
db/update/Service: migrate from DeferredMonitor to DeferEvent
Diffstat (limited to 'src/db/update')
-rw-r--r-- | src/db/update/Service.cxx | 6 | ||||
-rw-r--r-- | src/db/update/Service.hxx | 14 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/db/update/Service.cxx b/src/db/update/Service.cxx index 2bd605fad..d6c8e82ec 100644 --- a/src/db/update/Service.cxx +++ b/src/db/update/Service.cxx @@ -40,7 +40,7 @@ UpdateService::UpdateService(EventLoop &_loop, SimpleDatabase &_db, CompositeStorage &_storage, DatabaseListener &_listener) - :DeferredMonitor(_loop), + :defer(_loop, BIND_THIS_METHOD(RunDeferred)), db(_db), storage(_storage), listener(_listener), update_thread(BIND_THIS_METHOD(Task)) @@ -136,7 +136,7 @@ UpdateService::Task() else LogDebug(update_domain, "finished"); - DeferredMonitor::Schedule(); + defer.Schedule(); } void @@ -237,7 +237,7 @@ UpdateService::Enqueue(const char *path, bool discard) * Called in the main thread after the database update is finished. */ void -UpdateService::RunDeferred() +UpdateService::RunDeferred() noexcept { assert(next.IsDefined()); assert(walk != nullptr); diff --git a/src/db/update/Service.hxx b/src/db/update/Service.hxx index b0cbd2d60..5f90f7c0e 100644 --- a/src/db/update/Service.hxx +++ b/src/db/update/Service.hxx @@ -22,7 +22,7 @@ #include "check.h" #include "Queue.hxx" -#include "event/DeferredMonitor.hxx" +#include "event/DeferEvent.hxx" #include "thread/Thread.hxx" #include "Compiler.h" @@ -34,7 +34,9 @@ class CompositeStorage; /** * This class manages the update queue and runs the update thread. */ -class UpdateService final : DeferredMonitor { +class UpdateService final { + DeferEvent defer; + SimpleDatabase &db; CompositeStorage &storage; @@ -61,6 +63,10 @@ public: ~UpdateService(); + EventLoop &GetEventLoop() noexcept { + return defer.GetEventLoop(); + } + /** * Returns a non-zero job id when we are currently updating * the database. @@ -93,8 +99,8 @@ public: void CancelMount(const char *uri); private: - /* virtual methods from class DeferredMonitor */ - virtual void RunDeferred() override; + /* DeferEvent callback */ + void RunDeferred() noexcept; /* the update thread */ void Task(); |