add RageThread::ResumeAllThreads

This commit is contained in:
Glenn Maynard
2004-01-12 01:36:25 +00:00
parent 42ccf07011
commit d4c151937e
2 changed files with 37 additions and 4 deletions
+33 -4
View File
@@ -293,11 +293,40 @@ void RageThread::HaltAllThreads( bool Kill )
continue;
if( ThisThreadID == (int) g_ThreadSlots[entry].threadid )
continue;
#ifdef _XBOX
SuspendThread( g_ThreadSlots[entry].ThreadHandle );
#else
TerminateThread( g_ThreadSlots[entry].ThreadHandle, 0 );
#ifndef _XBOX
if( Kill )
TerminateThread( g_ThreadSlots[entry].ThreadHandle, 0 );
else
#endif
SuspendThread( g_ThreadSlots[entry].ThreadHandle );
}
#endif
}
void RageThread::ResumeAllThreads()
{
#if defined(PID_BASED_THREADS)
/* Send a SIGCONT to all other threads. */
int ThisThread = getpid();
for( int entry = 0; entry < MAX_THREADS; ++entry )
{
if( !g_ThreadSlots[entry].used )
continue;
const int pid = g_ThreadSlots[entry].pid;
if( pid <= 0 || pid == ThisThread )
continue;
kill( pid, SIGCONT );
}
#elif defined(WIN32)
const int ThisThreadID = GetCurrentThreadId();
for( int entry = 0; entry < MAX_THREADS; ++entry )
{
if( !g_ThreadSlots[entry].used )
continue;
if( ThisThreadID == (int) g_ThreadSlots[entry].threadid )
continue;
ResumeThread( g_ThreadSlots[entry].ThreadHandle );
}
#endif
}
+4
View File
@@ -21,6 +21,10 @@ public:
/* For crash handlers: kill or suspend all threads (except for
* the running one) immediately. */
static void HaltAllThreads( bool Kill=false );
/* If HaltAllThreads was called (with Kill==false), resume. */
static void ResumeAllThreads();
static const char *GetCurThreadName();
int Wait();