From 3146bf51e6d22cd89ad84355bcbf98b237e69d43 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 5 Mar 2016 19:40:11 +0100 Subject: [PATCH] db/update/Service: eliminate attribute "progress" Use walk!=nullptr instead. --- src/db/update/Service.cxx | 8 +------- src/db/update/Service.hxx | 8 -------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/db/update/Service.cxx b/src/db/update/Service.cxx index 0383d6bae..85732dadd 100644 --- a/src/db/update/Service.cxx +++ b/src/db/update/Service.cxx @@ -45,7 +45,6 @@ UpdateService::UpdateService(EventLoop &_loop, SimpleDatabase &_db, :DeferredMonitor(_loop), db(_db), storage(_storage), listener(_listener), - progress(UPDATE_PROGRESS_IDLE), update_task_id(0), walk(nullptr) { @@ -140,7 +139,6 @@ UpdateService::Task() else LogDebug(update_domain, "finished"); - progress = UPDATE_PROGRESS_DONE; DeferredMonitor::Schedule(); } @@ -157,7 +155,6 @@ UpdateService::StartThread(UpdateQueueItem &&i) assert(GetEventLoop().IsInsideOrNull()); assert(walk == nullptr); - progress = UPDATE_PROGRESS_RUNNING; modified = false; next = std::move(i); @@ -231,7 +228,7 @@ UpdateService::Enqueue(const char *path, bool discard) happen */ return 0; - if (progress != UPDATE_PROGRESS_IDLE) { + if (walk != nullptr) { const unsigned id = GenerateId(); if (!queue.Push(*db2, *storage2, path, discard, id)) return 0; @@ -254,7 +251,6 @@ UpdateService::Enqueue(const char *path, bool discard) void UpdateService::RunDeferred() { - assert(progress == UPDATE_PROGRESS_DONE); assert(next.IsDefined()); assert(walk != nullptr); @@ -278,7 +274,5 @@ UpdateService::RunDeferred() if (i.IsDefined()) { /* schedule the next path */ StartThread(std::move(i)); - } else { - progress = UPDATE_PROGRESS_IDLE; } } diff --git a/src/db/update/Service.hxx b/src/db/update/Service.hxx index 68ea3f09e..c01846122 100644 --- a/src/db/update/Service.hxx +++ b/src/db/update/Service.hxx @@ -35,19 +35,11 @@ class CompositeStorage; * This class manages the update queue and runs the update thread. */ class UpdateService final : DeferredMonitor { - enum Progress { - UPDATE_PROGRESS_IDLE = 0, - UPDATE_PROGRESS_RUNNING = 1, - UPDATE_PROGRESS_DONE = 2 - }; - SimpleDatabase &db; CompositeStorage &storage; DatabaseListener &listener; - Progress progress; - bool modified; Thread update_thread;