[*] sched: minor clean up
This commit is contained in:
parent
573031cd96
commit
5b495f7fd9
@ -497,6 +497,7 @@ namespace Aurora::Threading
|
||||
#endif
|
||||
|
||||
auto uCurrent = *(AuUInt32 *)pCompareAddress;
|
||||
auto expect = WaitBuffer::From(pCompareAddress, uWordSize);
|
||||
|
||||
do
|
||||
{
|
||||
@ -519,7 +520,7 @@ namespace Aurora::Threading
|
||||
}
|
||||
while (ret == EINTR);
|
||||
|
||||
return true;
|
||||
return !expect.Compare(pTargetAddress);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
@ -16,9 +16,6 @@
|
||||
#define NTSTATUS_TIMEOUT 0x102
|
||||
#endif
|
||||
|
||||
// TODO: benchmark
|
||||
#define AUBUILD_REMOVE_PREHOG
|
||||
|
||||
namespace Aurora::Threading::Primitives
|
||||
{
|
||||
ConditionVariableImpl::ConditionVariableImpl(const AuSPtr<IConditionMutex> &pMutex) :
|
||||
@ -59,7 +56,7 @@ namespace Aurora::Threading::Primitives
|
||||
|
||||
if (qwTimeout)
|
||||
{
|
||||
#if !defined(AU_TRUST_NT_KERNEL_SCHED_TIMEOUT)
|
||||
#if defined(AU_TRUST_NT_KERNEL_SCHED_TIMEOUT)
|
||||
auto uEndTimeSteady = AuTime::SteadyClockNS() + qwTimeout;
|
||||
#endif
|
||||
auto uEndTimeWall = AuTime::CurrentClockNS() + qwTimeout;
|
||||
@ -87,18 +84,6 @@ namespace Aurora::Threading::Primitives
|
||||
|
||||
this->mutex_->Unlock();
|
||||
|
||||
#if !defined(AUBUILD_REMOVE_PREHOG)
|
||||
// forced smt stall
|
||||
// see the "hopefully nt is smart enough" comment
|
||||
// the idea is to prevent windows from taking away our time-slice in a preemptive manor
|
||||
// if the keyed event semaphore is ready, perhaps we can avoid switching to a different process entirely
|
||||
if (!bIOU)
|
||||
{
|
||||
bool b = true;
|
||||
bIOU = CheckOut(b);
|
||||
}
|
||||
#endif
|
||||
|
||||
bRet = pNtWaitForKeyedEvent(gKeyedEventHandle, &this->wlist, 0, &word) != NTSTATUS_TIMEOUT;
|
||||
|
||||
this->mutex_->Lock();
|
||||
@ -184,16 +169,6 @@ namespace Aurora::Threading::Primitives
|
||||
|
||||
this->mutex_->Unlock();
|
||||
|
||||
#if !defined(AUBUILD_REMOVE_PREHOG)
|
||||
// forced smp stall
|
||||
if (!bIOU)
|
||||
{
|
||||
bool b = true;
|
||||
bIOU = CheckOut(b);
|
||||
}
|
||||
#endif
|
||||
|
||||
// then into the kernel no matter what (hopefully nt is smart enough to have a fast path)
|
||||
pNtWaitForKeyedEvent(gKeyedEventHandle, &this->wlist, 0, nullptr);
|
||||
|
||||
this->mutex_->Lock();
|
||||
|
Loading…
Reference in New Issue
Block a user