Commit f6525468 authored by Max Kellermann's avatar Max Kellermann

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.
parent d64edb68
......@@ -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;
}
......@@ -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();
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment