diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index d04536b1c1..30a1df8e1b 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -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 } diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index 4e0cd22e01..8473634614 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -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();