trying to fix crash handler hangs when subthreads crash while the

main thread is holding a mutex
This commit is contained in:
Glenn Maynard
2004-01-17 00:34:34 +00:00
parent f014787146
commit a8e73bc3d7
+13 -6
View File
@@ -208,12 +208,19 @@ long __stdcall CrashHandler(EXCEPTION_POINTERS *pExc)
++InHere; ++InHere;
/* Now things get more risky. If we're fullscreen, the window will obscure the /* Now things get more risky. If we're fullscreen, the window will obscure the
* crash dialog. Try to hide the window. We stopped threads above; we need to * crash dialog. Try to hide the window. Things might blow up here; do this
* resume them now, or ShowWindow will deadlock. Things might blow up here; * after DoSave, so we always write a crash dump. */
* do this after DoSave, so we always write a crash dump. */ if( GetWindowThreadProcessId( g_hWndMain, NULL ) == GetCurrentThreadId() )
RageThread::ResumeAllThreads(); {
ShowWindow( g_hWndMain, SW_HIDE ); /* The thread that crashed was the thread that created the main window. Hide
RageThread::HaltAllThreads( false ); * the window. This will also restore the video mode, if necessary. */
ShowWindow( g_hWndMain, SW_HIDE );
} else {
/* A different thread crashed. Simply kill all other windows. We can't safely
* call ShowWindow; the main thread might be deadlocked. */
RageThread::HaltAllThreads( true );
ChangeDisplaySettings(NULL, 0);
}
if( g_bAutoRestart ) if( g_bAutoRestart )
Win32RestartProgram(); Win32RestartProgram();