[*] Fix busted timeout calc in the previous two commits

This commit is contained in:
Reece Wilson 2023-10-21 05:34:35 +01:00
parent 186444853d
commit e366d058f6
2 changed files with 8 additions and 4 deletions

View File

@ -115,7 +115,7 @@ namespace Aurora::IO::Loop
bool LSLocalMutex::TryTakeWaitMS(AuUInt32 timeout)
{
auto uEndTime = AuTime::SteadyClockMS() + timeout;
auto uEndTime = AuTime::SteadyClockNS() + AuMSToNS<AuUInt64>(timeout);
if (this->TryTakeSpin())
{
@ -139,7 +139,9 @@ namespace Aurora::IO::Loop
return false;
}
if (LSSemaphore::WaitOn(AuNSToMS<AuInt64>(uEndTime - uStartTime)))
auto uDeltaMs = AuNSToMS<AuInt64>(uEndTime - uStartTime);
if (uDeltaMs &&
LSSemaphore::WaitOn(uDeltaMs))
{
return true;
}

View File

@ -118,7 +118,7 @@ namespace Aurora::IO::Loop
bool LSLocalSemaphore::TryTakeWaitMS(AuUInt32 timeout)
{
auto uEndTime = AuTime::SteadyClockMS() + timeout;
auto uEndTime = AuTime::SteadyClockNS() + AuMSToNS<AuUInt64>(timeout);
if (this->TryTakeSpin())
{
@ -142,7 +142,9 @@ namespace Aurora::IO::Loop
return false;
}
if (LSSemaphore::WaitOn(AuNSToMS<AuInt64>(uEndTime - uStartTime)))
auto uDeltaMs = AuNSToMS<AuInt64>(uEndTime - uStartTime);
if (uDeltaMs &&
LSSemaphore::WaitOn(uDeltaMs))
{
return true;
}