use RageThreadRegister. These should be freed properly, so things still work if the driver is recreated for some reason. There may be no guarantee that the same thread will always call the I/O callback--it may recreate the thread on overload, for example ...

This commit is contained in:
Glenn Maynard
2005-12-19 02:06:56 +00:00
parent 9c1f81f9bd
commit dcfff261ed
@@ -33,10 +33,7 @@ static int g_iNumIOProcCalls = 0;
static void NameHALThread( CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info )
{
static RageThread HALNotificationThread;
HALNotificationThread.SetName( "HAL notification thread" );
HALNotificationThread.CreateThisThread();
static RageThreadRegister HALNotificationThread( "HAL notification thread" );
// Remove and release the observer
CFRunLoopRef runLoopRef = CFRunLoopGetCurrent();
@@ -264,13 +261,11 @@ OSStatus RageSound_CA::GetData( AudioDeviceID inDevice,
const AudioTimeStamp *inOutputTime,
void *inClientData )
{
static RageThread HALIOThread;
static bool bThreadCreated = false;
if( !likely(bThreadCreated) )
{
HALIOThread.SetName( "HAL I/O thread" );
HALIOThread.CreateThisThread();
static RageThreadRegister HALNotificationThread( "HAL I/O thread" );
bThreadCreated = true;
}