[*] Win32: Delegate last nights hack before bed to grug

(unix parity)
This commit is contained in:
Reece Wilson 2023-02-09 12:37:32 +00:00
parent 76069f2b43
commit cb920e1ee1

View File

@ -155,6 +155,19 @@ namespace Aurora::Exit
}
#if defined(AURORA_PLATFORM_WIN32)
static void SendExitSignal(Grug::Arrow *)
{
PostLevel(AuThreads::GetThread(), Exit::ETriggerLevel::eSigTerminate);
}
static void SendTerminateSignalAndBlock()
{
static Grug::Arrow arrow;
Grug::HurlArrow(&arrow, SendExitSignal, {});
Grug::ArrowWait(&arrow);
}
BOOL Win32BasicHandler(DWORD ctrlType)
{
if (ctrlType == CTRL_C_EVENT ||
@ -162,7 +175,7 @@ namespace Aurora::Exit
ctrlType == CTRL_SHUTDOWN_EVENT)
{
Exit::gHasCanceled = false;
Exit::PostLevel(AuThreads::GetThread(), Exit::ETriggerLevel::eSigTerminate);
SendTerminateSignalAndBlock();
return !AuExchange(Exit::gHasCanceled, false);
}