From 478ace984a3a162d3b5f5d72788a4426eceb75de Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 16 Jan 2014 08:45:55 +0100 Subject: db/upnp/WorkQueue: use emplace() and std::move() --- src/db/upnp/WorkQueue.hxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/db/upnp/WorkQueue.hxx') 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 + bool put(U &&u) { const ScopeLock protect(mutex); - queue.push(t); + queue.emplace(std::forward(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; } -- cgit v1.2.3