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

Move from std::queue to std::list which has better

behavior and swap() as well.  Should probably do this
for the other queues at some point.
parent cbf7e909
No related branches found
No related tags found
No related merge requests found
...@@ -1715,7 +1715,7 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat ...@@ -1715,7 +1715,7 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat
// LL_DEBUGS(LOG_MESH) << "info pelvis offset" << info.mPelvisOffset << LL_ENDL; // LL_DEBUGS(LOG_MESH) << "info pelvis offset" << info.mPelvisOffset << LL_ENDL;
{ {
LLMutexLock lock(mMutex); LLMutexLock lock(mMutex);
mSkinInfoQ.push(info); mSkinInfoQ.push_back(info);
} }
} }
...@@ -1745,7 +1745,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3 ...@@ -1745,7 +1745,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3
d->mMeshID = mesh_id; d->mMeshID = mesh_id;
{ {
LLMutexLock lock(mMutex); LLMutexLock lock(mMutex);
mDecompositionQ.push(d); mDecompositionQ.push_back(d);
} }
} }
...@@ -1807,7 +1807,7 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 ...@@ -1807,7 +1807,7 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32
{ {
LLMutexLock lock(mMutex); LLMutexLock lock(mMutex);
mDecompositionQ.push(d); mDecompositionQ.push_back(d);
} }
return true; return true;
} }
...@@ -2473,33 +2473,31 @@ void LLMeshRepoThread::notifyLoadedMeshes() ...@@ -2473,33 +2473,31 @@ void LLMeshRepoThread::notifyLoadedMeshes()
{ {
if (mMutex->trylock()) if (mMutex->trylock())
{ {
std::queue<LLMeshSkinInfo> skin_info_q; std::list<LLMeshSkinInfo> skin_info_q;
std::queue<LLModel::Decomposition*> decomp_q; std::list<LLModel::Decomposition*> decomp_q;
// swap() comes to std::queue in c++11 so copy manually for now if (! mSkinInfoQ.empty())
while (! mSkinInfoQ.empty())
{ {
skin_info_q.push(mSkinInfoQ.front()); skin_info_q.swap(mSkinInfoQ);
mSkinInfoQ.pop();
} }
while (! mDecompositionQ.empty()) if (! mDecompositionQ.empty())
{ {
decomp_q.push(mDecompositionQ.front()); decomp_q.swap(mDecompositionQ);
mDecompositionQ.pop();
} }
mMutex->unlock(); mMutex->unlock();
// Process the elements free of the lock // 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());
skin_info_q.pop(); skin_info_q.pop_front();
} }
while (! decomp_q.empty()) while (! decomp_q.empty())
{ {
gMeshRepo.notifyDecompositionReceived(decomp_q.front()); gMeshRepo.notifyDecompositionReceived(decomp_q.front());
decomp_q.pop(); decomp_q.pop_front();
} }
} }
} }
......
...@@ -291,8 +291,8 @@ class LLMeshRepoThread : public LLThread ...@@ -291,8 +291,8 @@ class LLMeshRepoThread : public LLThread
//set of requested skin info //set of requested skin info
std::set<LLUUID> mSkinRequests; std::set<LLUUID> mSkinRequests;
//queue of completed skin info requests // list of completed skin info requests
std::queue<LLMeshSkinInfo> mSkinInfoQ; std::list<LLMeshSkinInfo> mSkinInfoQ;
//set of requested decompositions //set of requested decompositions
std::set<LLUUID> mDecompositionRequests; std::set<LLUUID> mDecompositionRequests;
...@@ -300,8 +300,8 @@ class LLMeshRepoThread : public LLThread ...@@ -300,8 +300,8 @@ class LLMeshRepoThread : public LLThread
//set of requested physics shapes //set of requested physics shapes
std::set<LLUUID> mPhysicsShapeRequests; std::set<LLUUID> mPhysicsShapeRequests;
//queue of completed Decomposition info requests // list of completed Decomposition info requests
std::queue<LLModel::Decomposition*> mDecompositionQ; std::list<LLModel::Decomposition*> mDecompositionQ;
//queue of requested headers //queue of requested headers
std::queue<HeaderRequest> mHeaderReqQ; std::queue<HeaderRequest> mHeaderReqQ;
......
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