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