add RageThread::EnumThreadIDs
pass a ThreadId toForceCrashHandlerDeadlock; do away with crash handles
This commit is contained in:
@@ -269,6 +269,22 @@ const char *RageThread::GetThreadNameByID( uint64_t iID )
|
|||||||
return slot->GetThreadName();
|
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()
|
int RageThread::Wait()
|
||||||
{
|
{
|
||||||
ASSERT( m_pSlot != NULL );
|
ASSERT( m_pSlot != NULL );
|
||||||
@@ -558,7 +574,7 @@ void RageMutex::Lock()
|
|||||||
#if defined(CRASH_HANDLER) && !defined(DARWIN)
|
#if defined(CRASH_HANDLER) && !defined(DARWIN)
|
||||||
/* Don't leave g_ThreadSlotsLock when we call ForceCrashHandlerDeadlock. */
|
/* Don't leave g_ThreadSlotsLock when we call ForceCrashHandlerDeadlock. */
|
||||||
g_ThreadSlotsLock.Lock();
|
g_ThreadSlotsLock.Lock();
|
||||||
uint64_t CrashHandle = OtherSlot && OtherSlot->pImpl? OtherSlot->pImpl->GetCrashHandle():0;
|
uint64_t CrashHandle = OtherSlot? OtherSlot->id:0;
|
||||||
g_ThreadSlotsLock.Unlock();
|
g_ThreadSlotsLock.Unlock();
|
||||||
|
|
||||||
/* Pass the crash handle of the other thread, so it can backtrace that thread. */
|
/* Pass the crash handle of the other thread, so it can backtrace that thread. */
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
|
|
||||||
static const char *GetCurThreadName();
|
static const char *GetCurThreadName();
|
||||||
static const char *GetThreadNameByID( uint64_t iID );
|
static const char *GetThreadNameByID( uint64_t iID );
|
||||||
|
static bool EnumThreadIDs( int n, uint64_t &iID );
|
||||||
int Wait();
|
int Wait();
|
||||||
bool IsCreated() const { return m_pSlot != NULL; }
|
bool IsCreated() const { return m_pSlot != NULL; }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user