Make items popped from *worker::Queue const. Use std::move instead of std::forward in one place

This commit is contained in:
Tyler Neely 2022-11-04 11:33:02 +00:00
parent c745f8c877
commit fa5c9a2568
2 changed files with 3 additions and 3 deletions

View File

@ -86,7 +86,7 @@ class Queue {
MG_ASSERT(inner_.use_count() > 0);
std::unique_lock<std::mutex> lock(inner_->mu);
inner_->queue.emplace_back(std::forward<Message>(message));
inner_->queue.emplace_back(std::move(message));
} // lock dropped before notifying condition variable
inner_->cv.notify_all();
@ -100,7 +100,7 @@ class Queue {
inner_->cv.wait(lock);
}
Message message = std::move(inner_->queue.front());
const Message message = std::move(inner_->queue.front());
inner_->queue.pop_front();
return message;

View File

@ -109,7 +109,7 @@ class Queue {
inner_->cv.wait(lock);
}
Message message = std::move(inner_->queue.front());
const Message message = std::move(inner_->queue.front());
inner_->queue.pop_front();
return message;