From: Steve C. <ste...@us...> - 2007-03-25 23:52:01
|
Update of /cvsroot/stepmania/stepmania/src/arch/Sound In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18225 Modified Files: RageSoundDriver_AU.cpp Log Message: Handle race condition more intelligently by invalidating in the callback itself. Index: RageSoundDriver_AU.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -p -r1.14 -r1.15 --- RageSoundDriver_AU.cpp 24 Mar 2007 04:38:47 -0000 1.14 +++ RageSoundDriver_AU.cpp 25 Mar 2007 23:51:53 -0000 1.15 @@ -47,11 +47,10 @@ RageSoundDriver_AU::RageSoundDriver_AU() void RageSoundDriver_AU::NameHALThread( CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *inRefCon ) { RageSoundDriver_AU *This = (RageSoundDriver_AU *)inRefCon; - if( This->m_pNotificationThread == NULL ) - { - This->m_pNotificationThread = new RageThreadRegister( "HAL notification thread" ); - This->m_Semaphore.Post(); - } + CFRunLoopObserverInvalidate( observer ); + CFRelease( observer ); + This->m_pNotificationThread = new RageThreadRegister( "HAL notification thread" ); + This->m_Semaphore.Post(); } RString RageSoundDriver_AU::Init() @@ -160,8 +159,6 @@ RString RageSoundDriver_AU::Init() CFRunLoopAddObserver( runLoopRef, observerRef, kCFRunLoopDefaultMode ); CFRunLoopWakeUp( runLoopRef ); m_Semaphore.Wait(); - CFRunLoopObserverInvalidate( observerRef ); - CFRelease( observerRef ); } if( (error = AudioOutputUnitStart(m_OutputUnit)) ) |