This commit is contained in:
Reece Wilson 2023-09-02 21:24:37 +01:00
parent 5b9e780fa0
commit 1479bcaa22

View File

@ -81,13 +81,19 @@ namespace Aurora::Threading::Primitives
bool SemaphoreImpl::LockNS(AuUInt64 uTimeout) bool SemaphoreImpl::LockNS(AuUInt64 uTimeout)
{ {
AuUInt64 uStart {};
AuUInt64 uEnd {};
if (this->TryLockNoSpin()) if (this->TryLockNoSpin())
{ {
return true; return true;
} }
AuUInt64 uStart = AuTime::SteadyClockNS(); if (uTimeout)
AuUInt64 uEnd = uTimeout ? uStart + uTimeout : 0; {
uStart = AuTime::SteadyClockNS();
uEnd = uStart + uTimeout;
}
if (this->TryLockHeavy()) if (this->TryLockHeavy())
{ {