mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Avoid copying osg::ref_ptr when adding or removing item from work queue
Copy constructor does refcounting, and move constructor doesn't.
This commit is contained in:
parent
b8fcd6d3ba
commit
eece47f70e
2 changed files with 4 additions and 4 deletions
|
@ -74,9 +74,9 @@ void WorkQueue::addWorkItem(osg::ref_ptr<WorkItem> item, bool front)
|
|||
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
if (front)
|
||||
mQueue.push_front(item);
|
||||
mQueue.push_front(std::move(item));
|
||||
else
|
||||
mQueue.push_back(item);
|
||||
mQueue.push_back(std::move(item));
|
||||
mCondition.notify_one();
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ osg::ref_ptr<WorkItem> WorkQueue::removeWorkItem()
|
|||
}
|
||||
if (!mQueue.empty())
|
||||
{
|
||||
osg::ref_ptr<WorkItem> item = mQueue.front();
|
||||
osg::ref_ptr<WorkItem> item = std::move(mQueue.front());
|
||||
mQueue.pop_front();
|
||||
return item;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue