From d301f2093728cf3fc137f48f292e50c389cbb20c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 10 Aug 2004 01:27:42 +0000 Subject: [PATCH] make debugging deadlocks easier on systems without ForceCrashHandlerDeadlock --- stepmania/src/RageThreads.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 2c964819ca..da8e1cd271 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -543,9 +543,14 @@ void RageMutex::Lock() const ThreadSlot *ThisSlot = GetThreadSlotFromID( GetThisThreadId() ); const ThreadSlot *OtherSlot = GetThreadSlotFromID( m_LockedBy ); - const CString sReason = ssprintf( "Thread deadlock on mutex %s between %s and %s", GetName().c_str(), - ThisSlot? ThisSlot->GetThreadName(): "(???" ")", // stupid trigraph warnings - OtherSlot? OtherSlot->GetThreadName(): "(???" ")" ); + CString ThisSlotName = "(???" ")"; // stupid trigraph warnings + CString OtherSlotName = "(???" ")"; // stupid trigraph warnings + if( ThisSlot ) + ThisSlotName = ssprintf( "%s (%i)", ThisSlot->GetThreadName(), (int) ThisSlot->id ); + if( OtherSlot ) + OtherSlotName = ssprintf( "%s (%i)", OtherSlot->GetThreadName(), (int) OtherSlot->id ); + const CString sReason = ssprintf( "Thread deadlock on mutex %s between %s and %s", + GetName().c_str(), ThisSlotName.c_str(), OtherSlotName.c_str() ); #if defined(CRASH_HANDLER) && !defined(DARWIN) /* Don't leave g_ThreadSlotsLock when we call ForceCrashHandlerDeadlock. */ @@ -556,7 +561,7 @@ void RageMutex::Lock() /* Pass the crash handle of the other thread, so it can backtrace that thread. */ ForceCrashHandlerDeadlock( sReason, CrashHandle ); #else - RageException::Throw( "%s", sReason.c_str() ); + FAIL_M( sReason ); #endif }