예제 #1
0
파일: btThreads.cpp 프로젝트: 1vanK/Urho3D
 unsigned int getNext()
 {
     // no need to optimize this with atomics, it is only called ONCE per thread!
     mMutex.lock();
     unsigned int val = mCounter++;
     mMutex.unlock();
     return val;
 }
예제 #2
0
 void lockQueue()
 {
     if ( m_useSpinMutex )
     {
         m_mutex.lock();
     }
     else
     {
         m_queueLock->lock();
     }
 }
예제 #3
0
static btVector4 selectColor2()
{
#ifdef BT_THREADSAFE
	static btSpinMutex sMutex;
	sMutex.lock();
#endif
	static int curColor = 0;
	btVector4 color = colors[curColor];
	curColor++;
	curColor &= 3;
#ifdef BT_THREADSAFE
	sMutex.unlock();
#endif
	return color;
}