From 1479bcaa22af083b99f6b228da0ac3c2dea0b379 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sat, 2 Sep 2023 21:24:37 +0100 Subject: [PATCH] [*] bonk --- Source/Threading/Primitives/AuSemaphore.NT.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Threading/Primitives/AuSemaphore.NT.cpp b/Source/Threading/Primitives/AuSemaphore.NT.cpp index 18a94e40..61e80c95 100644 --- a/Source/Threading/Primitives/AuSemaphore.NT.cpp +++ b/Source/Threading/Primitives/AuSemaphore.NT.cpp @@ -81,13 +81,19 @@ namespace Aurora::Threading::Primitives bool SemaphoreImpl::LockNS(AuUInt64 uTimeout) { + AuUInt64 uStart {}; + AuUInt64 uEnd {}; + if (this->TryLockNoSpin()) { return true; } - AuUInt64 uStart = AuTime::SteadyClockNS(); - AuUInt64 uEnd = uTimeout ? uStart + uTimeout : 0; + if (uTimeout) + { + uStart = AuTime::SteadyClockNS(); + uEnd = uStart + uTimeout; + } if (this->TryLockHeavy()) {