From f65254680a8521631ecdd722ff522f574da20d8f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 27 Feb 2014 19:15:01 +0100 Subject: db/update/Queue: use std::list instead of std::queue The problem with std::queue is that it doesn't give us enough control. The method Clear() is a kludge already, but soon, we'll need filtering. --- src/db/update/Queue.cxx | 4 ++-- src/db/update/Queue.hxx | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/db') diff --git a/src/db/update/Queue.cxx b/src/db/update/Queue.cxx index 4bb0ae725..096a39a8c 100644 --- a/src/db/update/Queue.cxx +++ b/src/db/update/Queue.cxx @@ -26,7 +26,7 @@ UpdateQueue::Push(const char *path, bool discard, unsigned id) if (update_queue.size() >= MAX_UPDATE_QUEUE_SIZE) return false; - update_queue.emplace(path, discard, id); + update_queue.emplace_back(path, discard, id); return true; } @@ -37,6 +37,6 @@ UpdateQueue::Pop() return UpdateQueueItem(); auto i = std::move(update_queue.front()); - update_queue.pop(); + update_queue.pop_front(); return i; } diff --git a/src/db/update/Queue.hxx b/src/db/update/Queue.hxx index eb0b268bf..039c62fe3 100644 --- a/src/db/update/Queue.hxx +++ b/src/db/update/Queue.hxx @@ -23,7 +23,6 @@ #include "check.h" #include -#include #include struct UpdateQueueItem { @@ -44,7 +43,7 @@ struct UpdateQueueItem { class UpdateQueue { static constexpr unsigned MAX_UPDATE_QUEUE_SIZE = 32; - std::queue> update_queue; + std::list update_queue; public: bool Push(const char *path, bool discard, unsigned id); @@ -52,7 +51,7 @@ public: UpdateQueueItem Pop(); void Clear() { - update_queue = decltype(update_queue)(); + update_queue.clear(); } }; -- cgit v1.2.3