diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 8b94680857..e5825f6a60 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -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 } diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index 6945ca2298..dc03181169 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -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();