diff options
author | Monty Brandenberg <monty@lindenlab.com> | 2013-09-20 07:13:14 +0000 |
---|---|---|
committer | Monty Brandenberg <monty@lindenlab.com> | 2013-09-20 07:13:14 +0000 |
commit | 2462162539053e8cbf26aea68940f300bca5aa87 (patch) | |
tree | a441f7a5836f5fed4938cc2c3634dcffa7252cf5 | |
parent | cbf7e90954e69f86cbf530676e165f2feb6501bb (diff) |
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.
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 26 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.h | 8 |
2 files changed, 16 insertions, 18 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 23a9640761..b55ba758e1 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -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; { LLMutexLock lock(mMutex); - mSkinInfoQ.push(info); + mSkinInfoQ.push_back(info); } } @@ -1745,7 +1745,7 @@ bool LLMeshRepoThread::decompositionReceived(const LLUUID& mesh_id, U8* data, S3 d->mMeshID = mesh_id; { LLMutexLock lock(mMutex); - mDecompositionQ.push(d); + mDecompositionQ.push_back(d); } } @@ -1807,7 +1807,7 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 { LLMutexLock lock(mMutex); - mDecompositionQ.push(d); + mDecompositionQ.push_back(d); } return true; } @@ -2473,33 +2473,31 @@ void LLMeshRepoThread::notifyLoadedMeshes() { if (mMutex->trylock()) { - std::queue<LLMeshSkinInfo> skin_info_q; - std::queue<LLModel::Decomposition*> decomp_q; + std::list<LLMeshSkinInfo> skin_info_q; + std::list<LLModel::Decomposition*> decomp_q; - // swap() comes to std::queue in c++11 so copy manually for now - while (! mSkinInfoQ.empty()) + if (! mSkinInfoQ.empty()) { - skin_info_q.push(mSkinInfoQ.front()); - mSkinInfoQ.pop(); + skin_info_q.swap(mSkinInfoQ); } - while (! mDecompositionQ.empty()) + if (! mDecompositionQ.empty()) { - decomp_q.push(mDecompositionQ.front()); - mDecompositionQ.pop(); + decomp_q.swap(mDecompositionQ); } + mMutex->unlock(); // Process the elements free of the lock while (! skin_info_q.empty()) { gMeshRepo.notifySkinInfoReceived(skin_info_q.front()); - skin_info_q.pop(); + skin_info_q.pop_front(); } while (! decomp_q.empty()) { gMeshRepo.notifyDecompositionReceived(decomp_q.front()); - decomp_q.pop(); + decomp_q.pop_front(); } } } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index c79278da1a..e09f39f7a8 100755 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -291,8 +291,8 @@ public: //set of requested skin info std::set<LLUUID> mSkinRequests; - //queue of completed skin info requests - std::queue<LLMeshSkinInfo> mSkinInfoQ; + // list of completed skin info requests + std::list<LLMeshSkinInfo> mSkinInfoQ; //set of requested decompositions std::set<LLUUID> mDecompositionRequests; @@ -300,8 +300,8 @@ public: //set of requested physics shapes std::set<LLUUID> mPhysicsShapeRequests; - //queue of completed Decomposition info requests - std::queue<LLModel::Decomposition*> mDecompositionQ; + // list of completed Decomposition info requests + std::list<LLModel::Decomposition*> mDecompositionQ; //queue of requested headers std::queue<HeaderRequest> mHeaderReqQ; |