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)
{
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())
{