aboutsummaryrefslogtreecommitdiffstats
path: root/src/UpdateQueue.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 21:34:36 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 21:45:53 +0200
commitd44880dfa99197a8c1f4b65416470e6ffbe534f6 (patch)
treed1f0fdf941adb11802c8b7ae8811b707c3ac5794 /src/UpdateQueue.cxx
parent0c63632cc2354e662da67453043a039efb65ae28 (diff)
downloadmpd-d44880dfa99197a8c1f4b65416470e6ffbe534f6.tar.gz
mpd-d44880dfa99197a8c1f4b65416470e6ffbe534f6.tar.xz
mpd-d44880dfa99197a8c1f4b65416470e6ffbe534f6.zip
UpdateGlue: handle update id management
Add UpdateQueueItem::id to keep track of the id in every item. Replaces thhe hack in update_queue_push().
Diffstat (limited to 'src/UpdateQueue.cxx')
-rw-r--r--src/UpdateQueue.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/UpdateQueue.cxx b/src/UpdateQueue.cxx
index aa6074c7f..2a30e5d5f 100644
--- a/src/UpdateQueue.cxx
+++ b/src/UpdateQueue.cxx
@@ -27,14 +27,14 @@ static constexpr unsigned MAX_UPDATE_QUEUE_SIZE = 32;
static std::queue<UpdateQueueItem, std::list<UpdateQueueItem>> update_queue;
-unsigned
-update_queue_push(const char *path, bool discard, unsigned base)
+bool
+update_queue_push(const char *path, bool discard, unsigned id)
{
if (update_queue.size() >= MAX_UPDATE_QUEUE_SIZE)
- return 0;
+ return false;
- update_queue.emplace(path, discard);
- return base + update_queue.size();
+ update_queue.emplace(path, discard, id);
+ return true;
}
UpdateQueueItem