From f19bc684083ac79fad1cf3ef6017ef8c53a6cef6 Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Sun, 12 Aug 2007 17:37:36 +0000 Subject: [PATCH] fixed Win32 Threaded, by waiting for multiple objects (it was re-using the same task all the time) Thanks Marten Svanfeldt (Starbreeze Studios) for the fix --- .../Win32ThreadSupport.cpp | 27 +++++++++---------- .../BulletMultiThreaded/Win32ThreadSupport.h | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Extras/BulletMultiThreaded/Win32ThreadSupport.cpp b/Extras/BulletMultiThreaded/Win32ThreadSupport.cpp index 2e09d3bf2..af43e98fd 100644 --- a/Extras/BulletMultiThreaded/Win32ThreadSupport.cpp +++ b/Extras/BulletMultiThreaded/Win32ThreadSupport.cpp @@ -56,6 +56,7 @@ DWORD WINAPI Thread_no_1( LPVOID lpParam ) if (userPtr) { status->m_userThreadFunc(userPtr,status->m_lsMemory); + status->m_status = 2; SetEvent(status->m_eventCompletetHandle); } else { @@ -134,24 +135,17 @@ void Win32ThreadSupport::waitForResponse(unsigned int *puiArgument0, unsigned in btAssert(m_activeSpuStatus.size()); int last = -1; - - //find an active spu/thread - for (int i=0;i 1); spuStatus.m_status = 0; ///need to find an active spu @@ -176,6 +170,7 @@ void Win32ThreadSupport::startThreads(Win32ThreadConstructionInfo& threadConstru { m_activeSpuStatus.resize(threadConstructionInfo.m_numThreads); + m_completeHandles.resize(threadConstructionInfo.m_numThreads); for (int i=0;i m_activeSpuStatus; - + btAlignedObjectArray m_completeHandles; public: ///Setup and initialize SPU/CELL/Libspe2