[*] Update the FutexSemaphore to wake no more than the requested wake count
[*] Cleanup NTs semaphore
This commit is contained in:
parent
b35b290afd
commit
8b4ad9795c
@ -71,7 +71,7 @@ namespace Aurora::Threading::Waitables
|
||||
|
||||
if (auto uSleeping = AuAtomicLoad(&this->uAtomicSleeping))
|
||||
{
|
||||
WakeNOnAddress((const void *)&this->uAtomicState, uSleeping);
|
||||
WakeNOnAddress((const void *)&this->uAtomicState, AuMin(uSleeping, uThreads));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,10 +219,10 @@ namespace Aurora::Threading::Primitives
|
||||
return;
|
||||
}
|
||||
|
||||
AuAtomicAdd<AuUInt32>(&this->dwState_, uCount);
|
||||
|
||||
if (gUseNativeWaitSemapahore)
|
||||
{
|
||||
AuAtomicAdd<AuUInt32>(&this->dwState_, uCount);
|
||||
|
||||
if (auto dwSleeping = AuAtomicLoad(this->GetSleepCounter()))
|
||||
{
|
||||
if (uCount == 1)
|
||||
@ -237,14 +237,9 @@ namespace Aurora::Threading::Primitives
|
||||
}
|
||||
else
|
||||
{
|
||||
// realistically, we cant use the sleep counter optimization trick under windows 7
|
||||
// we would have to expand our already oversized by 8, 24-byte x86_64 semaphore for a trivial perf boost
|
||||
// we cant efficiently access the conditions state or atomic guarantees...
|
||||
|
||||
AuAtomicAdd<AuUInt32>(&this->dwState_, uCount); // this could be moved anywhere above the unlock, including above the lock.
|
||||
|
||||
// do not [re]move this lock fence
|
||||
{
|
||||
this->mutex.Lock(); // do not [re]move this lock fence
|
||||
this->mutex.Lock();
|
||||
this->mutex.Unlock();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user