From 732cf4b380baf10e1573017a573d1814e2bcb569 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 20 Apr 2004 03:44:38 +0000 Subject: [PATCH] cleanup --- stepmania/src/RageThreads.cpp | 20 ++++++++++++++++---- stepmania/src/RageThreads.h | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 03acd69ddd..ae1b01aef2 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -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(); } diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index b891f16daf..cd5ce7dbc9 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -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; } };