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

Fri, 20 Sep 2013 05:58:32 +0000

author
Monty Brandenberg <monty@lindenlab.com>
date
Fri, 20 Sep 2013 05:58:32 +0000
changeset 40728
a0591d41b496
parent 40727
f2b0a9f7b1c0
child 40729
6dd49a6d7675

Used a c++11 feature unintentionally. Use a more
traditional swap-less object transfer.

indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/llmeshrepository.cpp	Thu Sep 19 19:20:31 2013 -0400
     1.2 +++ b/indra/newview/llmeshrepository.cpp	Fri Sep 20 05:58:32 2013 +0000
     1.3 @@ -2471,16 +2471,25 @@
     1.4  
     1.5  	if (! mSkinInfoQ.empty() || ! mDecompositionQ.empty())
     1.6  	{
     1.7 -		std::queue<LLMeshSkinInfo> skin_info_q;
     1.8 -		std::queue<LLModel::Decomposition*> decomp_q;
     1.9 -
    1.10  		if (mMutex->trylock())
    1.11  		{
    1.12 -			// Make thread-shared data private with swap under lock.
    1.13 -			skin_info_q.swap(mSkinInfoQ);
    1.14 -			decomp_q.swap(mDecompositionQ);
    1.15 +			std::queue<LLMeshSkinInfo> skin_info_q;
    1.16 +			std::queue<LLModel::Decomposition*> decomp_q;
    1.17 +
    1.18 +			// swap() comes to std::queue in c++11 so copy manually for now
    1.19 +			while (! mSkinInfoQ.empty())
    1.20 +			{
    1.21 +				skin_info_q.push(mSkinInfoQ.front());
    1.22 +				mSkinInfoQ.pop();
    1.23 +			}
    1.24 +			while (! mDecompositionQ.empty())
    1.25 +			{
    1.26 +				decomp_q.push(mDecompositionQ.front());
    1.27 +				mDecompositionQ.pop();
    1.28 +			}
    1.29  			mMutex->unlock();
    1.30  
    1.31 +			// Process the elements free of the lock
    1.32  			while (! skin_info_q.empty())
    1.33  			{
    1.34  				gMeshRepo.notifySkinInfoReceived(skin_info_q.front());

mercurial