예제 #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
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;
}
예제 #3
0
 void unlockQueue()
 {
     if ( m_useSpinMutex )
     {
         m_mutex.unlock();
     }
     else
     {
         m_queueLock->unlock();
     }
 }