aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-16 08:45:55 +0100
committerMax Kellermann <max@duempel.org>2014-01-16 08:46:41 +0100
commit478ace984a3a162d3b5f5d72788a4426eceb75de (patch)
tree5ee44edf31cd4615d182393027672f7a45c51432
parent028fd268b89163c9c6e938794064339f0989d6a0 (diff)
downloadmpd-478ace984a3a162d3b5f5d72788a4426eceb75de.tar.gz
mpd-478ace984a3a162d3b5f5d72788a4426eceb75de.tar.xz
mpd-478ace984a3a162d3b5f5d72788a4426eceb75de.zip
db/upnp/WorkQueue: use emplace() and std::move()
Diffstat (limited to '')
-rw-r--r--src/db/upnp/WorkQueue.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/db/upnp/WorkQueue.hxx b/src/db/upnp/WorkQueue.hxx
index 274b85995..7537fb874 100644
--- a/src/db/upnp/WorkQueue.hxx
+++ b/src/db/upnp/WorkQueue.hxx
@@ -119,11 +119,12 @@ public:
*
* Sleeps if there are already too many.
*/
- bool put(T t)
+ template<typename U>
+ bool put(U &&u)
{
const ScopeLock protect(mutex);
- queue.push(t);
+ queue.emplace(std::forward<U>(u));
// Just wake one worker, there is only one new task.
worker_cond.signal();
@@ -178,7 +179,7 @@ public:
return false;
}
- tp = queue.front();
+ tp = std::move(queue.front());
queue.pop();
return true;
}