Fix pessimizing move warning being emitted by the compiler

master
Rye 2025-02-03 11:42:21 -05:00
parent 36d4dc4e2b
commit 594a7afce6
1 changed files with 3 additions and 1 deletions

View File

@ -452,7 +452,9 @@ ElementT LLThreadSafeQueue<ElementT, QueueT>::pop(void)
// so we can finish draining the queue.
pop_result popped = pop_(lock1, value);
if (popped == POPPED)
return std::move(value);
// don't use std::move when returning local value because
// it prevents the compiler from optimizing with copy elision
return value;
// Once the queue is DONE, there will never be any more coming.
if (popped == DONE)