only use the mutex if using BT_THREADSAFE

This commit is contained in:
erwincoumans
2018-12-22 11:35:56 -08:00
parent 63ac2182ae
commit fb2baa81d6

View File

@@ -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;
} }