mirror of
https://github.com/bulletphysics/bullet3
synced 2025-01-18 21:10:05 +00:00
fix potential asan/tsan issue
This commit is contained in:
parent
703767c6f3
commit
d17d496f97
@ -201,7 +201,8 @@ struct MotionArgs
|
||||
{
|
||||
m_vrControllerEvents[i].m_buttons[b]=0;
|
||||
}
|
||||
|
||||
m_vrControllerPos[i].setValue(0,0,0);
|
||||
m_vrControllerOrn[i].setValue(0,0,0,1);
|
||||
m_isVrControllerPicking[i] = false;
|
||||
m_isVrControllerDragging[i] = false;
|
||||
m_isVrControllerReleasing[i] = false;
|
||||
@ -1747,6 +1748,8 @@ void PhysicsServerExample::initPhysics()
|
||||
m_threadSupport = createMotionThreadSupport(MAX_MOTION_NUM_THREADS);
|
||||
|
||||
|
||||
m_isConnected = m_physicsServer.connectSharedMemory( m_guiHelper);
|
||||
|
||||
|
||||
for (int i=0;i<m_threadSupport->getNumTasks();i++)
|
||||
{
|
||||
@ -1765,18 +1768,25 @@ void PhysicsServerExample::initPhysics()
|
||||
m_args[w].m_cs2 = m_threadSupport->createCriticalSection();
|
||||
m_args[w].m_cs3 = m_threadSupport->createCriticalSection();
|
||||
m_args[w].m_csGUI = m_threadSupport->createCriticalSection();
|
||||
|
||||
m_args[w].m_cs->lock();
|
||||
m_args[w].m_cs->setSharedParam(0,eMotionIsUnInitialized);
|
||||
m_args[w].m_cs->unlock();
|
||||
int numMoving = 0;
|
||||
m_args[w].m_positions.resize(numMoving);
|
||||
m_args[w].m_physicsServerPtr = &m_physicsServer;
|
||||
//int index = 0;
|
||||
|
||||
m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*) &this->m_args[w], w);
|
||||
bool isUninitialized = true;
|
||||
|
||||
while (m_args[w].m_cs->getSharedParam(0)==eMotionIsUnInitialized)
|
||||
while (isUninitialized)
|
||||
{
|
||||
m_args[w].m_cs->lock();
|
||||
isUninitialized = (m_args[w].m_cs->getSharedParam(0)==eMotionIsUnInitialized);
|
||||
m_args[w].m_cs->unlock();
|
||||
#ifdef _WIN32
|
||||
b3Clock::usleep(1000);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1789,8 +1799,6 @@ void PhysicsServerExample::initPhysics()
|
||||
m_args[0].m_cs2->lock();
|
||||
|
||||
|
||||
m_isConnected = m_physicsServer.connectSharedMemory( m_guiHelper);
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user