diff --git a/Source/Async/ThreadPool.cpp b/Source/Async/ThreadPool.cpp index 9ac1f4dd..fc0230c4 100644 --- a/Source/Async/ThreadPool.cpp +++ b/Source/Async/ThreadPool.cpp @@ -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); } diff --git a/Source/Exit/AuExit.cpp b/Source/Exit/AuExit.cpp index 1a555e13..dee8d526 100644 --- a/Source/Exit/AuExit.cpp +++ b/Source/Exit/AuExit.cpp @@ -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()