From 414c7361794131743ba80693762c6747752bf2f7 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Mon, 18 Dec 2023 07:37:48 +0000 Subject: [PATCH] [+] ELoopSource expansion --- Include/Aurora/IO/Loop/ELoopSource.hpp | 7 ++++++- Source/IO/Loop/LSLocalEvent.cpp | 2 +- Source/IO/Loop/LSLocalMutex.cpp | 2 +- Source/IO/Loop/LSLocalSemaphore.cpp | 2 +- Source/IO/Loop/Loop.cpp | 16 ++++++++-------- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Include/Aurora/IO/Loop/ELoopSource.hpp b/Include/Aurora/IO/Loop/ELoopSource.hpp index 822ee3ec..1d02ec5a 100644 --- a/Include/Aurora/IO/Loop/ELoopSource.hpp +++ b/Include/Aurora/IO/Loop/ELoopSource.hpp @@ -15,7 +15,7 @@ namespace Aurora::IO::Loop eSourceSemaphore, eSourceCV, eSourceEvent, - eSourceMutex, // WARNING: You should not use kernel mutex objects over AuThreadPrimitives + eSourceMutex, eSourceSRW, eSourceTimer, @@ -56,5 +56,10 @@ namespace Aurora::IO::Loop eSourceInternalReserved2, eSourceInternalReserved3, eSourceInternalReserved4, + + // fast objects + eSourceFastSemaphore, + eSourceFastEvent, + eSourceFastMutex }; } \ No newline at end of file diff --git a/Source/IO/Loop/LSLocalEvent.cpp b/Source/IO/Loop/LSLocalEvent.cpp index 74f9e138..2b150484 100644 --- a/Source/IO/Loop/LSLocalEvent.cpp +++ b/Source/IO/Loop/LSLocalEvent.cpp @@ -91,7 +91,7 @@ namespace Aurora::IO::Loop ELoopSource LSLocalEvent::GetType() { - return ELoopSource::eSourceEvent; + return ELoopSource::eSourceFastEvent; } bool LSLocalEvent::Set() diff --git a/Source/IO/Loop/LSLocalMutex.cpp b/Source/IO/Loop/LSLocalMutex.cpp index 2f94bf73..e585db28 100644 --- a/Source/IO/Loop/LSLocalMutex.cpp +++ b/Source/IO/Loop/LSLocalMutex.cpp @@ -98,7 +98,7 @@ namespace Aurora::IO::Loop ELoopSource LSLocalMutex::GetType() { - return ELoopSource::eSourceMutex; + return ELoopSource::eSourceFastMutex; } bool LSLocalMutex::TryTakeNoSpin() diff --git a/Source/IO/Loop/LSLocalSemaphore.cpp b/Source/IO/Loop/LSLocalSemaphore.cpp index 7aafa388..fad5b932 100644 --- a/Source/IO/Loop/LSLocalSemaphore.cpp +++ b/Source/IO/Loop/LSLocalSemaphore.cpp @@ -130,7 +130,7 @@ namespace Aurora::IO::Loop ELoopSource LSLocalSemaphore::GetType() { - return ELoopSource::eSourceSemaphore; + return ELoopSource::eSourceFastSemaphore; } bool LSLocalSemaphore::TryTakeNoSpin() diff --git a/Source/IO/Loop/Loop.cpp b/Source/IO/Loop/Loop.cpp index 8970c1c8..ef010e14 100644 --- a/Source/IO/Loop/Loop.cpp +++ b/Source/IO/Loop/Loop.cpp @@ -302,9 +302,9 @@ namespace Aurora::IO::Loop auto eType = pSource->GetType(); - if (eType == ELoopSource::eSourceMutex || - eType == ELoopSource::eSourceSemaphore || - eType == ELoopSource::eSourceEvent) + if (eType == ELoopSource::eSourceFastMutex || + eType == ELoopSource::eSourceFastSemaphore || + eType == ELoopSource::eSourceFastEvent) { auto pSourceEx = AuDynamicCast(pSource); @@ -377,7 +377,7 @@ namespace Aurora::IO::Loop } bool bTooMany {}; -#if defined(AURORA_IS_MODERNNT_DERIVED) + #if defined(AURORA_IS_MODERNNT_DERIVED) if (AuBuild::kCurrentVendor == AuBuild::EVendor::eGenericMicrosoft && lsList2.size() < MAXIMUM_WAIT_OBJECTS) { @@ -387,7 +387,7 @@ namespace Aurora::IO::Loop false; } else -#endif + #endif { bTooMany = true; } @@ -501,9 +501,9 @@ namespace Aurora::IO::Loop auto eType = pLoopSource->GetType(); if (!bTimeout || - eType == ELoopSource::eSourceMutex || - eType == ELoopSource::eSourceSemaphore || - eType == ELoopSource::eSourceEvent) + eType == ELoopSource::eSourceFastMutex || + eType == ELoopSource::eSourceFastSemaphore || + eType == ELoopSource::eSourceFastEvent) { if (pLoopSource->IsSignaledNoSpinIfUserland()) {