halt/killing threads

This commit is contained in:
Glenn Maynard
2003-07-27 07:00:13 +00:00
parent 7db6d230df
commit cb50cf3f79
2 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -201,9 +201,16 @@ int RageThread::Wait()
return ret;
}
void RageThread::HaltAllThreads()
void RageThread::HaltAllThreads( bool Kill )
{
#if defined(PID_BASED_THREADS)
/* Send a SIGSTOP to all other threads. If we send a SIGKILL, pthreads
* will "helpfully" propagate it to the other threads, and we'll get
* killed, too.
*
* This isn't ideal, since it can cause the process to background
* as far as the shell is concerned, so the shell prompt can display
* before the crash handler actually displays a message. */
int ThisThread = getpid();
for( int entry = 0; entry < MAX_THREADS; ++entry )
{
@@ -212,7 +219,7 @@ void RageThread::HaltAllThreads()
const int pid = g_ThreadSlots[entry].pid;
if( pid <= 0 || pid == ThisThread )
continue;
kill( pid, SIGKILL );
kill( pid, Kill? SIGKILL:SIGSTOP );
}
#endif
}
+1 -1
View File
@@ -19,7 +19,7 @@ public:
/* For crash handlers: kill or suspend all threads (except for
* the running one) immediately. */
static void HaltAllThreads();
static void HaltAllThreads( bool Kill=false );
static const char *GetCurThreadName();
int Wait();