[+] Missing Win32 exit handler. I was dumb enough to rely on the debug exception

[*] ...no this wont do for now
This commit is contained in:
Reece Wilson 2023-02-09 00:42:56 +00:00
parent 8293484a86
commit fa9f190635
2 changed files with 22 additions and 1 deletions

View File

@ -377,6 +377,7 @@ namespace Aurora::Async
EarlyExitTick();
return success;
}
@ -1309,11 +1310,13 @@ namespace Aurora::Async
if (!this->GetThreadState()->bIsKiller)
{
AU_LOCK_GUARD(this->rwlock_->AsReadable());
#if 0
// TODO... i know what to do
#else
// this will do for now
if (!jobWorker->rejecting)
if (!jobWorker->rejecting &&
!this->shutdown)
{
this->Barrier(AuAsync::GetCurrentWorkerPId(), 0, false , true);
}

View File

@ -154,6 +154,20 @@ namespace Aurora::Exit
gHasCanceled = true;
}
#if defined(AURORA_PLATFORM_WIN32)
BOOL Win32BasicHandler(DWORD ctrlType)
{
if (ctrlType == CTRL_C_EVENT)
{
Exit::gHasCanceled = false;
Exit::PostLevel(AuThreads::GetThread(), Exit::ETriggerLevel::eSigTerminate);
return !AuExchange(Exit::gHasCanceled, false);
}
return true;
}
#endif
void InitExit()
{
gMutex = AuThreadPrimitives::MutexUnique();
@ -162,6 +176,10 @@ namespace Aurora::Exit
#if defined(AURORA_IS_POSIX_DERIVED)
InitUnix();
#endif
#if defined(AURORA_PLATFORM_WIN32)
SetConsoleCtrlHandler((PHANDLER_ROUTINE)Win32BasicHandler, TRUE);
#endif
}
void DeinitExit()