cleanup
This commit is contained in:
@@ -163,20 +163,23 @@ static int FindEmptyThreadSlot()
|
||||
RageException::Throw("Out of thread slots!");
|
||||
}
|
||||
|
||||
static int GetCurThreadSlot()
|
||||
static int GetThreadSlotFromID( unsigned int iID )
|
||||
{
|
||||
Uint32 ThisThread = SDL_ThreadID();
|
||||
|
||||
for( int entry = 0; entry < MAX_THREADS; ++entry )
|
||||
{
|
||||
if( !g_ThreadSlots[entry].used )
|
||||
continue;
|
||||
if( g_ThreadSlots[entry].threadid == ThisThread )
|
||||
if( g_ThreadSlots[entry].threadid == iID )
|
||||
return entry;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int GetCurThreadSlot()
|
||||
{
|
||||
return GetThreadSlotFromID( RageThread::GetCurrentThreadID() );
|
||||
}
|
||||
|
||||
static int GetUnknownThreadSlot()
|
||||
{
|
||||
for( int entry = 0; entry < MAX_THREADS; ++entry )
|
||||
@@ -319,6 +322,15 @@ const char *RageThread::GetCurThreadName()
|
||||
if(slot==-1)
|
||||
return "???";
|
||||
|
||||
return GetThreadNameByID( GetCurrentThreadID() );
|
||||
}
|
||||
|
||||
const char *RageThread::GetThreadNameByID( unsigned int iID )
|
||||
{
|
||||
int slot = GetThreadSlotFromID( iID );
|
||||
if( slot == -1 )
|
||||
return "???";
|
||||
|
||||
return g_ThreadSlots[slot].GetThreadName();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
static unsigned int GetCurrentThreadID();
|
||||
|
||||
static const char *GetCurThreadName();
|
||||
|
||||
static const char *GetThreadNameByID( unsigned int iID );
|
||||
int Wait();
|
||||
bool IsCreated() const { return thr != NULL; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user