From f72c05297b0ce32a2a0835f152352ca2111ec269 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 15 Apr 2024 21:08:12 -0500 Subject: [PATCH] wait for panic event to be ready before aborting --- src/sys_win32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sys_win32.c b/src/sys_win32.c index d7cecc31..6f072732 100644 --- a/src/sys_win32.c +++ b/src/sys_win32.c @@ -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; }