wait for panic event to be ready before aborting

This commit is contained in:
jacob 2024-04-15 21:08:12 -05:00
parent 3f1d714e7b
commit f72c05297b

View File

@ -2116,14 +2116,17 @@ int CALLBACK wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev_instance,
}
}
/* Panic message was set */
/* Check if panicking */
if (atomic_i32_eval(&G.panicking)) {
/* Wait for panic message to be ready */
WaitForSingleObject(G.panic_event, INFINITE);
/* Force stop threads */
for (struct win32_thread *t = G.threads_last; t; t = t->prev) {
HANDLE handle = t->handle;
TerminateThread(handle, 0);
CloseHandle(handle);
}
/* Set error and abort */
error_msg = G.panic_wstr;
goto abort;
}