[*] pls do a zoomie
This commit is contained in:
parent
b4b7e4a083
commit
2863d2c910
@ -27,9 +27,9 @@ namespace Aurora::Threading::Primitives
|
||||
Win32ConditionMutex();
|
||||
~Win32ConditionMutex();
|
||||
|
||||
bool TryLock() override;
|
||||
void Lock() override;
|
||||
void Unlock() override;
|
||||
auline bool TryLock() override;
|
||||
auline void Lock() override;
|
||||
auline void Unlock() override;
|
||||
AuUInt GetOSHandle() override;
|
||||
|
||||
NT4Mutex lock_;
|
||||
|
@ -51,6 +51,15 @@ namespace Aurora::Threading::Primitives
|
||||
LARGE_INTEGER word;
|
||||
word.QuadPart = uTargetTimeNt;
|
||||
|
||||
|
||||
// forced smp stall
|
||||
// see the "hopefully nt is smart enough" comment
|
||||
bool bIOU = DoTryIf([=]()
|
||||
{
|
||||
bool b = true;
|
||||
return CheckOut(b);
|
||||
});
|
||||
|
||||
if (bRet)
|
||||
{
|
||||
while (true)
|
||||
@ -74,7 +83,11 @@ namespace Aurora::Threading::Primitives
|
||||
bRet = pNtWaitForKeyedEvent(gKeyedEventHandle, &this->wlist, 0, &word) != NTSTATUS_TIMEOUT;
|
||||
}
|
||||
|
||||
#if !defined(AU_TRUST_NT_KERNEL_SCHED_TIMEOUT)
|
||||
if (!bRet)
|
||||
#else
|
||||
if (!bRet && uEndTimeSteady <= AuTime::SteadyClockNS())
|
||||
#endif
|
||||
{
|
||||
auto uNow = this->wlist;
|
||||
auto uOld = (uNow >> 2u);
|
||||
@ -83,7 +96,7 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
// broadcast has woken everyone up
|
||||
|
||||
if (CheckOut(bRet)) // the cope acquire
|
||||
if (bIOU || CheckOut(bRet)) // the cope acquire
|
||||
{
|
||||
// in which case we're good
|
||||
this->mutex_->Lock();
|
||||
@ -105,7 +118,7 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
// break if successful
|
||||
this->mutex_->Lock();
|
||||
return false;
|
||||
return bIOU;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -117,13 +130,12 @@ namespace Aurora::Threading::Primitives
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CheckOut(bRet))
|
||||
// we good?
|
||||
if (bIOU || CheckOut(bRet))
|
||||
{
|
||||
continue;
|
||||
this->mutex_->Lock();
|
||||
return true;
|
||||
}
|
||||
|
||||
this->mutex_->Lock();
|
||||
return bRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,9 +155,17 @@ namespace Aurora::Threading::Primitives
|
||||
}
|
||||
}
|
||||
|
||||
// forced smp stall
|
||||
bool bIOU = DoTryIf([=]()
|
||||
{
|
||||
bool b = true;
|
||||
return CheckOut(b);
|
||||
});
|
||||
|
||||
// then into the kernel no matter what (hopefully nt is smart enough to have a fast path)
|
||||
pNtWaitForKeyedEvent(gKeyedEventHandle, &this->wlist, 0, nullptr);
|
||||
|
||||
if (CheckOut(bRet))
|
||||
if (bIOU || CheckOut(bRet))
|
||||
{
|
||||
this->mutex_->Lock();
|
||||
return bRet;
|
||||
|
Loading…
Reference in New Issue
Block a user