remove CreateThisThread
This commit is contained in:
@@ -190,8 +190,7 @@ static ThreadSlot *GetUnknownThreadSlot()
|
|||||||
return g_pUnknownThreadSlot;
|
return g_pUnknownThreadSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
RageThread::RageThread():
|
RageThread::RageThread()
|
||||||
m_bThisThread( false )
|
|
||||||
{
|
{
|
||||||
m_pSlot = NULL;
|
m_pSlot = NULL;
|
||||||
}
|
}
|
||||||
@@ -247,36 +246,6 @@ void RageThread::Create( int (*fn)(void *), void *data )
|
|||||||
m_pSlot->pImpl = MakeThread( fn, data, &m_pSlot->id );
|
m_pSlot->pImpl = MakeThread( fn, data, &m_pSlot->id );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageThread::CreateThisThread()
|
|
||||||
{
|
|
||||||
ASSERT( m_pSlot == NULL );
|
|
||||||
|
|
||||||
InitThreads();
|
|
||||||
m_bThisThread = true;
|
|
||||||
LockMut( g_ThreadSlotsLock );
|
|
||||||
|
|
||||||
int slotno = FindEmptyThreadSlot();
|
|
||||||
|
|
||||||
m_pSlot = &g_ThreadSlots[slotno];
|
|
||||||
|
|
||||||
if( name == "" )
|
|
||||||
{
|
|
||||||
if( LOG )
|
|
||||||
LOG->Warn( "Created a thread without naming it first." );
|
|
||||||
|
|
||||||
/* If you don't name it, I will: */
|
|
||||||
strcpy( m_pSlot->name, "Jon" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy( m_pSlot->name, name.c_str() );
|
|
||||||
}
|
|
||||||
sprintf( m_pSlot->ThreadFormattedOutput, "Thread: %s", name.c_str() );
|
|
||||||
|
|
||||||
m_pSlot->id = GetThisThreadId();
|
|
||||||
m_pSlot->pImpl = MakeThisThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
RageThreadRegister::RageThreadRegister( const CString &sName )
|
RageThreadRegister::RageThreadRegister( const CString &sName )
|
||||||
{
|
{
|
||||||
InitThreads();
|
InitThreads();
|
||||||
@@ -338,12 +307,7 @@ int RageThread::Wait()
|
|||||||
{
|
{
|
||||||
ASSERT( m_pSlot != NULL );
|
ASSERT( m_pSlot != NULL );
|
||||||
ASSERT( m_pSlot->pImpl != NULL );
|
ASSERT( m_pSlot->pImpl != NULL );
|
||||||
int ret;
|
int ret = m_pSlot->pImpl->Wait();
|
||||||
|
|
||||||
if( m_bThisThread )
|
|
||||||
ret = 0;
|
|
||||||
else
|
|
||||||
ret = m_pSlot->pImpl->Wait();
|
|
||||||
|
|
||||||
LockMut( g_ThreadSlotsLock );
|
LockMut( g_ThreadSlotsLock );
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public:
|
|||||||
void SetName( const CString &n ) { name = n; }
|
void SetName( const CString &n ) { name = n; }
|
||||||
CString GetName() const { return name; }
|
CString GetName() const { return name; }
|
||||||
void Create( int (*fn)(void *), void *data );
|
void Create( int (*fn)(void *), void *data );
|
||||||
void CreateThisThread();
|
|
||||||
|
|
||||||
/* For crash handlers: kill or suspend all threads (except for
|
/* For crash handlers: kill or suspend all threads (except for
|
||||||
* the running one) immediately. */
|
* the running one) immediately. */
|
||||||
@@ -43,7 +42,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
ThreadSlot *m_pSlot;
|
ThreadSlot *m_pSlot;
|
||||||
CString name;
|
CString name;
|
||||||
bool m_bThisThread;
|
|
||||||
|
|
||||||
static bool s_bSystemSupportsTLS;
|
static bool s_bSystemSupportsTLS;
|
||||||
static bool s_bIsShowingDialog;
|
static bool s_bIsShowingDialog;
|
||||||
|
|||||||
Reference in New Issue
Block a user