Fix crash if thread exits before the dtor is called.

This commit is contained in:
Steve Checkoway
2005-12-17 12:32:59 +00:00
parent 353e0c5b6e
commit 21a9c65791
2 changed files with 5 additions and 3 deletions
+4 -3
View File
@@ -190,7 +190,8 @@ static ThreadSlot *GetUnknownThreadSlot()
return g_pUnknownThreadSlot;
}
RageThread::RageThread()
RageThread::RageThread():
m_bThisThread( false )
{
m_pSlot = NULL;
}
@@ -251,7 +252,7 @@ void RageThread::CreateThisThread()
ASSERT( m_pSlot == NULL );
InitThreads();
m_bThisThread = true;
LockMut( g_ThreadSlotsLock );
int slotno = FindEmptyThreadSlot();
@@ -312,7 +313,7 @@ int RageThread::Wait()
ASSERT( m_pSlot->pImpl != NULL );
int ret;
if( m_pSlot->id == GetThisThreadId() )
if( m_bThisThread )
ret = 0;
else
ret = m_pSlot->pImpl->Wait();