From 0ce4716c0e144570ce9a8bcc5bb9520fc73fab63 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 7 Sep 2004 02:58:59 +0000 Subject: [PATCH] add RageThread::EnumThreadIDs pass a ThreadId toForceCrashHandlerDeadlock; do away with crash handles --- stepmania/src/RageThreads.cpp | 18 +++++++++++++++++- stepmania/src/RageThreads.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 22bd3c5430..147a31cd34 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -269,6 +269,22 @@ const char *RageThread::GetThreadNameByID( uint64_t iID ) return slot->GetThreadName(); } +bool RageThread::EnumThreadIDs( int n, uint64_t &iID ) +{ + if( n >= MAX_THREADS ) + return false; + + LockMut(g_ThreadSlotsLock); + const ThreadSlot *slot = &g_ThreadSlots[n]; + + if( slot->used ) + iID = slot->id; + else + iID = GetInvalidThreadId(); + + return true; +} + int RageThread::Wait() { ASSERT( m_pSlot != NULL ); @@ -558,7 +574,7 @@ void RageMutex::Lock() #if defined(CRASH_HANDLER) && !defined(DARWIN) /* Don't leave g_ThreadSlotsLock when we call ForceCrashHandlerDeadlock. */ g_ThreadSlotsLock.Lock(); - uint64_t CrashHandle = OtherSlot && OtherSlot->pImpl? OtherSlot->pImpl->GetCrashHandle():0; + uint64_t CrashHandle = OtherSlot? OtherSlot->id:0; g_ThreadSlotsLock.Unlock(); /* Pass the crash handle of the other thread, so it can backtrace that thread. */ diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index b69c52b69e..526744c280 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -25,6 +25,7 @@ public: static const char *GetCurThreadName(); static const char *GetThreadNameByID( uint64_t iID ); + static bool EnumThreadIDs( int n, uint64_t &iID ); int Wait(); bool IsCreated() const { return m_pSlot != NULL; } };