[*] improve latency (i think - benchmark pending)
This commit is contained in:
parent
8667d1059f
commit
50f25e147a
@ -16,6 +16,9 @@
|
||||
#define NTSTATUS_TIMEOUT 0x102
|
||||
#endif
|
||||
|
||||
// TODO: benchmark
|
||||
#define AUBUILD_REMOVE_PREHOG
|
||||
|
||||
namespace Aurora::Threading::Primitives
|
||||
{
|
||||
ConditionVariableImpl::ConditionVariableImpl(const AuSPtr<IConditionMutex> &pMutex) :
|
||||
@ -84,6 +87,7 @@ 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
|
||||
@ -93,6 +97,7 @@ namespace Aurora::Threading::Primitives
|
||||
bool b = true;
|
||||
bIOU = CheckOut(b);
|
||||
}
|
||||
#endif
|
||||
|
||||
bRet = pNtWaitForKeyedEvent(gKeyedEventHandle, &this->wlist, 0, &word) != NTSTATUS_TIMEOUT;
|
||||
|
||||
@ -179,12 +184,14 @@ 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);
|
||||
|
Loading…
Reference in New Issue
Block a user