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

Fri, 20 Sep 2013 07:13:14 +0000

author
Monty Brandenberg <monty@lindenlab.com>
date
Fri, 20 Sep 2013 07:13:14 +0000
changeset 40729
6dd49a6d7675
parent 40728
a0591d41b496
child 40730
cb203df9d1b2

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.

indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
indra/newview/llmeshrepository.h file | annotate | diff | revisions
     1.1 --- a/indra/newview/llmeshrepository.cpp	Fri Sep 20 05:58:32 2013 +0000
     1.2 +++ b/indra/newview/llmeshrepository.cpp	Fri Sep 20 07:13:14 2013 +0000
     1.3 @@ -1715,7 +1715,7 @@
     1.4  		// LL_DEBUGS(LOG_MESH) << "info pelvis offset" << info.mPelvisOffset << LL_ENDL;
     1.5  		{
     1.6  			LLMutexLock lock(mMutex);
     1.7 -			mSkinInfoQ.push(info);
     1.8 +			mSkinInfoQ.push_back(info);
     1.9  		}
    1.10  	}
    1.11  
    1.12 @@ -1745,7 +1745,7 @@
    1.13  		d->mMeshID = mesh_id;
    1.14  		{
    1.15  			LLMutexLock lock(mMutex);
    1.16 -			mDecompositionQ.push(d);
    1.17 +			mDecompositionQ.push_back(d);
    1.18  		}
    1.19  	}
    1.20  
    1.21 @@ -1807,7 +1807,7 @@
    1.22  
    1.23  	{
    1.24  		LLMutexLock lock(mMutex);
    1.25 -		mDecompositionQ.push(d);
    1.26 +		mDecompositionQ.push_back(d);
    1.27  	}
    1.28  	return true;
    1.29  }
    1.30 @@ -2473,33 +2473,31 @@
    1.31  	{
    1.32  		if (mMutex->trylock())
    1.33  		{
    1.34 -			std::queue<LLMeshSkinInfo> skin_info_q;
    1.35 -			std::queue<LLModel::Decomposition*> decomp_q;
    1.36 -
    1.37 -			// swap() comes to std::queue in c++11 so copy manually for now
    1.38 -			while (! mSkinInfoQ.empty())
    1.39 +			std::list<LLMeshSkinInfo> skin_info_q;
    1.40 +			std::list<LLModel::Decomposition*> decomp_q;
    1.41 +
    1.42 +			if (! mSkinInfoQ.empty())
    1.43  			{
    1.44 -				skin_info_q.push(mSkinInfoQ.front());
    1.45 -				mSkinInfoQ.pop();
    1.46 +				skin_info_q.swap(mSkinInfoQ);
    1.47  			}
    1.48 -			while (! mDecompositionQ.empty())
    1.49 +			if (! mDecompositionQ.empty())
    1.50  			{
    1.51 -				decomp_q.push(mDecompositionQ.front());
    1.52 -				mDecompositionQ.pop();
    1.53 +				decomp_q.swap(mDecompositionQ);
    1.54  			}
    1.55 +
    1.56  			mMutex->unlock();
    1.57  
    1.58  			// Process the elements free of the lock
    1.59  			while (! skin_info_q.empty())
    1.60  			{
    1.61  				gMeshRepo.notifySkinInfoReceived(skin_info_q.front());
    1.62 -				skin_info_q.pop();
    1.63 +				skin_info_q.pop_front();
    1.64  			}
    1.65  
    1.66  			while (! decomp_q.empty())
    1.67  			{
    1.68  				gMeshRepo.notifyDecompositionReceived(decomp_q.front());
    1.69 -				decomp_q.pop();
    1.70 +				decomp_q.pop_front();
    1.71  			}
    1.72  		}
    1.73  	}
     2.1 --- a/indra/newview/llmeshrepository.h	Fri Sep 20 05:58:32 2013 +0000
     2.2 +++ b/indra/newview/llmeshrepository.h	Fri Sep 20 07:13:14 2013 +0000
     2.3 @@ -291,8 +291,8 @@
     2.4  	//set of requested skin info
     2.5  	std::set<LLUUID> mSkinRequests;
     2.6  	
     2.7 -	//queue of completed skin info requests
     2.8 -	std::queue<LLMeshSkinInfo> mSkinInfoQ;
     2.9 +	// list of completed skin info requests
    2.10 +	std::list<LLMeshSkinInfo> mSkinInfoQ;
    2.11  
    2.12  	//set of requested decompositions
    2.13  	std::set<LLUUID> mDecompositionRequests;
    2.14 @@ -300,8 +300,8 @@
    2.15  	//set of requested physics shapes
    2.16  	std::set<LLUUID> mPhysicsShapeRequests;
    2.17  
    2.18 -	//queue of completed Decomposition info requests
    2.19 -	std::queue<LLModel::Decomposition*> mDecompositionQ;
    2.20 +	// list of completed Decomposition info requests
    2.21 +	std::list<LLModel::Decomposition*> mDecompositionQ;
    2.22  
    2.23  	//queue of requested headers
    2.24  	std::queue<HeaderRequest> mHeaderReqQ;

mercurial