mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00: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
|
@ -492,7 +492,7 @@ namespace MWRender
|
||||||
|
|
||||||
workItem->mTextures.emplace_back("textures/_land_default.dds");
|
workItem->mTextures.emplace_back("textures/_land_default.dds");
|
||||||
|
|
||||||
mWorkQueue->addWorkItem(workItem);
|
mWorkQueue->addWorkItem(std::move(workItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
double RenderingManager::getReferenceTime() const
|
double RenderingManager::getReferenceTime() const
|
||||||
|
|
|
@ -74,9 +74,9 @@ void WorkQueue::addWorkItem(osg::ref_ptr<WorkItem> item, bool front)
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(mMutex);
|
std::unique_lock<std::mutex> lock(mMutex);
|
||||||
if (front)
|
if (front)
|
||||||
mQueue.push_front(item);
|
mQueue.push_front(std::move(item));
|
||||||
else
|
else
|
||||||
mQueue.push_back(item);
|
mQueue.push_back(std::move(item));
|
||||||
mCondition.notify_one();
|
mCondition.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ osg::ref_ptr<WorkItem> WorkQueue::removeWorkItem()
|
||||||
}
|
}
|
||||||
if (!mQueue.empty())
|
if (!mQueue.empty())
|
||||||
{
|
{
|
||||||
osg::ref_ptr<WorkItem> item = mQueue.front();
|
osg::ref_ptr<WorkItem> item = std::move(mQueue.front());
|
||||||
mQueue.pop_front();
|
mQueue.pop_front();
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue