Skip to content
Snippets Groups Projects
Commit cbf7e909 authored by Monty Brandenberg's avatar Monty Brandenberg
Browse files

Used a c++11 feature unintentionally. Use a more

traditional swap-less object transfer.
parent a232fa4d
No related branches found
No related tags found
No related merge requests found
...@@ -2471,16 +2471,25 @@ void LLMeshRepoThread::notifyLoadedMeshes() ...@@ -2471,16 +2471,25 @@ void LLMeshRepoThread::notifyLoadedMeshes()
if (! mSkinInfoQ.empty() || ! mDecompositionQ.empty()) if (! mSkinInfoQ.empty() || ! mDecompositionQ.empty())
{ {
std::queue<LLMeshSkinInfo> skin_info_q;
std::queue<LLModel::Decomposition*> decomp_q;
if (mMutex->trylock()) if (mMutex->trylock())
{ {
// Make thread-shared data private with swap under lock. std::queue<LLMeshSkinInfo> skin_info_q;
skin_info_q.swap(mSkinInfoQ); std::queue<LLModel::Decomposition*> decomp_q;
decomp_q.swap(mDecompositionQ);
// swap() comes to std::queue in c++11 so copy manually for now
while (! mSkinInfoQ.empty())
{
skin_info_q.push(mSkinInfoQ.front());
mSkinInfoQ.pop();
}
while (! mDecompositionQ.empty())
{
decomp_q.push(mDecompositionQ.front());
mDecompositionQ.pop();
}
mMutex->unlock(); mMutex->unlock();
// Process the elements free of the lock
while (! skin_info_q.empty()) while (! skin_info_q.empty())
{ {
gMeshRepo.notifySkinInfoReceived(skin_info_q.front()); gMeshRepo.notifySkinInfoReceived(skin_info_q.front());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment