From 7b59cab36e781916aacbfd6e4bd3e8c93ed7889b Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sun, 31 Dec 2023 16:46:00 +0000 Subject: [PATCH] [*] eepy --- Include/Aurora/Async/IWorkItem.hpp | 20 ++++++++++--------- Include/Aurora/IO/Loop/ILoopQueue.hpp | 5 +---- Include/Aurora/RNG/RNG.hpp | 2 +- Include/Aurora/RuntimeConfig.hpp | 2 +- .../Threading/Primitives/SOOPrimitives.hpp | 2 +- Source/RNG/AuRNGStaticUtilities.cpp | 5 +++++ 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Include/Aurora/Async/IWorkItem.hpp b/Include/Aurora/Async/IWorkItem.hpp index 081b0ac6..16249d49 100644 --- a/Include/Aurora/Async/IWorkItem.hpp +++ b/Include/Aurora/Async/IWorkItem.hpp @@ -14,22 +14,24 @@ namespace Aurora::Async virtual AuSPtr WaitFor(const AuSPtr &pWorkItem) = 0; virtual AuSPtr WaitFor(const AuList> &workItems) = 0; + // do not schedule a loop-source more than once + // you may ILoopSource::WaitOn arbitrarily; however, you must not attach it to the threads loopqueue more than once. virtual AuSPtr SetSchedByLoopSource(const AuSPtr &pLoopSource) = 0; - // ms = time relative to the current time + // ms = time relative to the current time in milliseconds virtual AuSPtr SetSchedTime(AuUInt32 ms) = 0; - // ns = Aurora::Time::CurrentClockMS() + relativeMs - virtual AuSPtr SetSchedTimeAbs(AuUInt32 ms) = 0; - - // ns = time relative to the current time + // ns = time relative to the current time in nanoseconds virtual AuSPtr SetSchedTimeNs(AuUInt64 ns) = 0; - // ns = Aurora::Time::CurrentClockNS() + relativeNs + // ms = wall time (AuTime::CurrentClockMS()) in milliseconds + virtual AuSPtr SetSchedTimeAbs(AuUInt32 ms) = 0; + + // ns = wall time (AuTime::CurrentClockNS()) in nanoseconds virtual AuSPtr SetSchedTimeNsAbs(AuUInt64 ns) = 0; - // ns = Aurora::Time::SteadyClockNS() + relativeNs - virtual AuSPtr SetSchedSteadyTimeNsAbs(AuUInt64 ns) = 0; + // ns = steady time (AuTime::SteadyClockNS()) in nanoseconds + virtual AuSPtr SetSchedSteadyTimeNsAbs(AuUInt64 ns) = 0; // ms = time relative to the time at which the work item would otherwise dispatch virtual AuSPtr AddDelayTime(AuUInt32 ms) = 0; @@ -42,7 +44,7 @@ namespace Aurora::Async virtual AuSPtr Dispatch() = 0; - virtual void SetPrio(EWorkPriority prio) = 0; + virtual void SetPrio(EWorkPriority prio) = 0; virtual bool BlockUntilComplete() = 0; virtual bool HasFinished() = 0; diff --git a/Include/Aurora/IO/Loop/ILoopQueue.hpp b/Include/Aurora/IO/Loop/ILoopQueue.hpp index cc4b1d0f..42c8cbff 100644 --- a/Include/Aurora/IO/Loop/ILoopQueue.hpp +++ b/Include/Aurora/IO/Loop/ILoopQueue.hpp @@ -52,12 +52,9 @@ namespace Aurora::IO::Loop virtual bool SourceRemove(const AuSPtr &source) = 0; /** - * @brief Updates the OS watchdog list cache concept after Source[Remove/Add[WithTimeout]] + * @brief Updates the OS watch list after Source[Remove/Add[WithTimeout]] * Commits may occur while another thread is waiting on the loop queue. * In those circumstances, they are internally preempted and rescheduled. - * WaitAnd has undefined behaviour across MT commit. Linux *might* work. - * NT wont until an APC-as-a-preempt-signal hack is implemented. - * Rare edge case for all i care - it'll remain a blocking edge case for.now. * @return * @note thread safe */ diff --git a/Include/Aurora/RNG/RNG.hpp b/Include/Aurora/RNG/RNG.hpp index 6b2b3e27..15c86887 100644 --- a/Include/Aurora/RNG/RNG.hpp +++ b/Include/Aurora/RNG/RNG.hpp @@ -28,7 +28,7 @@ namespace Aurora::RNG AUKN_SYM double RngDecimal(); AUKN_SYM float RngNumber(float min, float max); AUKN_SYM AuUInt32 RngIndex(AuUInt32 count /* = max + 1*/); - + AUKN_SYM uuids::uuid RngUUID(); // Note: it is conceivable that someone may want the following templates for some cryptographic purpose diff --git a/Include/Aurora/RuntimeConfig.hpp b/Include/Aurora/RuntimeConfig.hpp index 6d5fbc3a..20e1cbaf 100644 --- a/Include/Aurora/RuntimeConfig.hpp +++ b/Include/Aurora/RuntimeConfig.hpp @@ -224,7 +224,7 @@ namespace Aurora AuUInt64 bPreferLinuxAdaptiveSpin : 1 { true }; // (&&) AuUInt64 bPreferOldWin32AdaptiveSpin : 1 { false }; // (&&) AuUInt64 bPreferNewWin32AdaptiveSpin : 1 { true }; // (&&) - AuUInt64 uAdaptiveSpinCUCnt0 : 4 { 0 } ; + AuUInt64 uAdaptiveSpinCUCnt0 : 4 { 0 }; AuUInt64 uAdaptiveSpinCUCnt4 : 4 { 2 }; AuUInt64 uAdaptiveSpinCUCnt8 : 4 { 2 }; AuUInt64 uAdaptiveSpinCUCnt16 : 4 { 4 }; diff --git a/Include/Aurora/Threading/Primitives/SOOPrimitives.hpp b/Include/Aurora/Threading/Primitives/SOOPrimitives.hpp index 13be19a3..95721e49 100644 --- a/Include/Aurora/Threading/Primitives/SOOPrimitives.hpp +++ b/Include/Aurora/Threading/Primitives/SOOPrimitives.hpp @@ -14,7 +14,7 @@ namespace Aurora::Threading::Primitives { - static const auto kDefaultPrimitiveSize64 = 128; + static const auto kDefaultPrimitiveSize64 = 32; // Define all the sizes of the primitives on each platform by word-size, preprocessed to filter irrelevant/unknown architectures: #if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86) diff --git a/Source/RNG/AuRNGStaticUtilities.cpp b/Source/RNG/AuRNGStaticUtilities.cpp index 7c278186..b2079dda 100644 --- a/Source/RNG/AuRNGStaticUtilities.cpp +++ b/Source/RNG/AuRNGStaticUtilities.cpp @@ -67,4 +67,9 @@ namespace Aurora::RNG { return gFastDevice->NextIndex(uCount); } + + AUKN_SYM uuids::uuid RngUUID() + { + return gFastDevice->NextUUID(); + } } \ No newline at end of file