[*] Unix signal handlers shouldn't be Linux exclusive

This commit is contained in:
Reece Wilson 2022-04-07 06:31:38 +01:00
parent 1c78c18997
commit 9da2147756
2 changed files with 9 additions and 5 deletions

View File

@ -9,7 +9,10 @@
#include "Exit.hpp" #include "Exit.hpp"
#include <Source/Grug/Grug.hpp> #include <Source/Grug/Grug.hpp>
#include "MTWatchDog.hpp" #include "MTWatchDog.hpp"
#include "Exit.Unix.hpp"
#if defined(AURORA_IS_POSIX_DERIVED)
#include "Exit.Unix.hpp"
#endif
namespace Aurora::Exit namespace Aurora::Exit
{ {
@ -64,6 +67,7 @@ namespace Aurora::Exit
static AuUInt32 gProblemCounter = {}; static AuUInt32 gProblemCounter = {};
// Mitigate reused stack, nested try/catch, spam
if (level == ETriggerLevel::eProblematicEvent) if (level == ETriggerLevel::eProblematicEvent)
{ {
if (AuAtomicTestAndSet(&gProblemCounter, 1)) if (AuAtomicTestAndSet(&gProblemCounter, 1))
@ -101,7 +105,7 @@ namespace Aurora::Exit
gHasSentTerminate |= isTerminate; gHasSentTerminate |= isTerminate;
} }
// Force exit after calling the subscribers, should the even level be eSigTerminate // Force exit after calling the subscribers, should the level be eSigTerminate
if (level == ETriggerLevel::eSigTerminate) if (level == ETriggerLevel::eSigTerminate)
{ {
// HACK: // HACK:
@ -149,14 +153,14 @@ namespace Aurora::Exit
gMutex = AuThreadPrimitives::MutexUnique(); gMutex = AuThreadPrimitives::MutexUnique();
InitWatchdog(); InitWatchdog();
#if defined(AURORA_IS_LINUX_DERIVED) #if defined(AURORA_IS_POSIX_DERIVED)
InitUnix(); InitUnix();
#endif #endif
} }
void DeinitExit() void DeinitExit()
{ {
#if defined(AURORA_IS_LINUX_DERIVED) #if defined(AURORA_IS_POSIX_DERIVED)
DeinitUnix(); DeinitUnix();
#endif #endif

View File

@ -121,7 +121,7 @@ namespace Aurora::IO::FS
return Loop::ELoopSource::eSourceFileWatcher; return Loop::ELoopSource::eSourceFileWatcher;
} }
// Event type is latching, not a type of binary semaphore // Event type is latching, sort of like binary semaphore
// Resignal if work is still available // Resignal if work is still available
void NTEvent::OnPresleep() void NTEvent::OnPresleep()
{ {