[+] bool AuFutexSemaphore::LockUntilEqualAbsNS(AuUInt32 uValue, AuOptional<AuUInt64> qwTimeoutAbs)
This commit is contained in:
parent
3c6d5a020b
commit
cc4d97d6e7
@ -156,6 +156,28 @@ namespace Aurora::Threading::Waitables
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool LockUntilEqualAbsNS(AuUInt32 uValue,
|
||||
AuOptional<AuUInt64> qwTimeoutAbs)
|
||||
{
|
||||
const AuUInt32 kRef { uValue };
|
||||
|
||||
while (!TryWaitOnAddressUntilEqual((const void *)&this->uAtomicState, &kRef, sizeof(kRef)))
|
||||
{
|
||||
bool bStatus {};
|
||||
|
||||
AuAtomicAdd(&this->uAtomicSleeping, 1u);
|
||||
bStatus = WaitOnAddressUntilEqualSteady((const void *)&this->uAtomicState, &kRef, sizeof(kRef), qwTimeoutAbs.ValueOr(0), true);
|
||||
AuAtomicSub(&this->uAtomicSleeping, 1u);
|
||||
|
||||
if (!bStatus)
|
||||
{
|
||||
return TryWaitOnAddressUntilEqual((const void *)&this->uAtomicState, &kRef, sizeof(kRef));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AuAUInt32 uAtomicState {};
|
||||
AuAUInt32 uAtomicSleeping {};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user