aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-27 19:15:01 +0100
committerMax Kellermann <max@duempel.org>2014-02-27 20:49:13 +0100
commitf65254680a8521631ecdd722ff522f574da20d8f (patch)
treec23b73ae978cf5ca4aa51d81eb3fe19747f77726 /src/db
parentd64edb68966ebba3b15a5c3c5fb863db73f1aec3 (diff)
downloadmpd-f65254680a8521631ecdd722ff522f574da20d8f.tar.gz
mpd-f65254680a8521631ecdd722ff522f574da20d8f.tar.xz
mpd-f65254680a8521631ecdd722ff522f574da20d8f.zip
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.
Diffstat (limited to 'src/db')
-rw-r--r--src/db/update/Queue.cxx4
-rw-r--r--src/db/update/Queue.hxx5
2 files changed, 4 insertions, 5 deletions
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 <string>
-#include <queue>
#include <list>
struct UpdateQueueItem {
@@ -44,7 +43,7 @@ struct UpdateQueueItem {
class UpdateQueue {
static constexpr unsigned MAX_UPDATE_QUEUE_SIZE = 32;
- std::queue<UpdateQueueItem, std::list<UpdateQueueItem>> update_queue;
+ std::list<UpdateQueueItem> 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();
}
};