only use the mutex if using BT_THREADSAFE
This commit is contained in:
@@ -31,13 +31,17 @@ static btVector4 colors[4] =
|
|||||||
|
|
||||||
static btVector4 selectColor2()
|
static btVector4 selectColor2()
|
||||||
{
|
{
|
||||||
|
#ifdef BT_THREADSAFE
|
||||||
static btSpinMutex sMutex;
|
static btSpinMutex sMutex;
|
||||||
sMutex.lock();
|
sMutex.lock();
|
||||||
|
#endif
|
||||||
static int curColor = 0;
|
static int curColor = 0;
|
||||||
btVector4 color = colors[curColor];
|
btVector4 color = colors[curColor];
|
||||||
curColor++;
|
curColor++;
|
||||||
curColor &= 3;
|
curColor &= 3;
|
||||||
|
#ifdef BT_THREADSAFE
|
||||||
sMutex.unlock();
|
sMutex.unlock();
|
||||||
|
#endif
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user