diff options
-rw-r--r-- | src/db/upnp/WorkQueue.hxx | 7 |
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; } |