[*] Minor ConditionVariableNT optimization (SteadyClockNS() may syscall under vms)

This commit is contained in:
Reece Wilson 2024-04-11 19:53:09 +01:00
parent f2eadb4653
commit 9f5c0e559c

View File

@ -45,18 +45,19 @@ namespace Aurora::Threading::Primitives
{ {
#if !defined(AURORA_FORCE_SRW_LOCKS) #if !defined(AURORA_FORCE_SRW_LOCKS)
bool bRet { true }; bool bRet { true };
bool bIOU {};
auto pThatMutex = reinterpret_cast<NT4Mutex *>(&pMutex->lock_); auto pThatMutex = reinterpret_cast<NT4Mutex *>(&pMutex->lock_);
this->AddWaiter();
pMutex->Unlock();
if (qwTimeout) if (qwTimeout)
{ {
auto uEndTimeSteady = gUseNativeWaitCondvar ? AuTime::SteadyClockNS() + qwTimeout : 0; auto uEndTimeSteady = gUseNativeWaitCondvar ? AuTime::SteadyClockNS() + qwTimeout : 0;
auto uEndTimeWall = AuTime::CurrentClockNS() + qwTimeout; auto uEndTimeWall = AuTime::CurrentClockNS() + qwTimeout;
auto uTargetTimeNt = AuTime::ConvertTimestampNs(uEndTimeWall); auto uTargetTimeNt = AuTime::ConvertTimestampNs(uEndTimeWall);
bool bIOU {};
this->AddWaiter();
pMutex->Unlock();
while (true) while (true)
{ {
@ -171,12 +172,6 @@ namespace Aurora::Threading::Primitives
} }
else else
{ {
bool bIOU {};
this->AddWaiter();
pMutex->Unlock();
while (true) while (true)
{ {
if (gUseNativeWaitCondvar) if (gUseNativeWaitCondvar)