[*] Clean up dead-code in AuWakeOnAddress.cpp

This commit is contained in:
Reece Wilson 2023-12-05 07:56:57 +00:00
parent 91cff7ae26
commit f79be42357
2 changed files with 4 additions and 57 deletions

View File

@ -63,24 +63,6 @@ namespace Aurora::Threading
}
}
bool WaitEntry::TryAcquire(const void *pAddress, AuUInt8 uSize)
{
DoSpinLockOnVar(&this->uAtomic);
//AU_LOCK_GUARD(this->mutex);
if (this->pAddress)
{
this->uAtomic = 0;
return false;
}
this->pAddress = pAddress;
this->uSize = uSize;
this->uAtomic = 0;
return true;
}
void WaitEntry::Release()
{
AuResetMember(this->uSize);
@ -144,40 +126,13 @@ namespace Aurora::Threading
return false;
}
bool WaitEntry::TryWake(const void *pAddress)
{
DoSpinLockOnVar(&this->uAtomic);
auto bRet = TryWakeNoLock(pAddress);
if (!bRet)
{
this->uAtomic = 0;
}
return bRet;
}
bool WaitEntry::TryWakeNoLockNoReallyNoLock(const void *pAddress)
bool WaitEntry::TrySignalAddress(const void *pAddress)
{
if (this->pAddress != pAddress)
{
return false;
}
this->uAtomic = 0;
this->variable.Signal();
return true;
}
bool WaitEntry::TryWakeNoLock(const void *pAddress)
{
if (this->pAddress != pAddress)
{
return false;
}
AU_LOCK_GUARD(this->mutex);
this->uAtomic = 0;
this->variable.Signal();
return true;
}
@ -254,11 +209,8 @@ namespace Aurora::Threading
auto pReturn = &tlsWaitEntry;
#endif
pReturn->bReleaseOnWake = true;
pReturn->pAddress = pAddress;
pReturn->uSize = uSize;
pReturn->uAtomic = 0;
{
Lock();
@ -998,7 +950,7 @@ namespace Aurora::Threading
}
bool bWake {};
if (entry.TryWakeNoLockNoReallyNoLock(pTargetAddress))
if (entry.TrySignalAddress(pTargetAddress))
{
bWake = true;
uNMaximumThreads--;
@ -1026,7 +978,7 @@ namespace Aurora::Threading
{
(void)gProcessWaitables.IterateWake(pTargetAddress, [&](WaitEntry &entry) -> AuPair<bool, bool>
{
return AuMakePair(true, entry.TryWakeNoLockNoReallyNoLock(pTargetAddress));
return AuMakePair(true, entry.TrySignalAddress(pTargetAddress));
});
}
}

View File

@ -47,7 +47,6 @@ namespace Aurora::Threading
WaitEntry *pBefore {};
// synch
AuUInt32 uAtomic {}; // fastpath
Primitives::ConditionMutexInternal mutex; // mutex ctor must come before var
Primitives::ConditionVariableInternal variable; // ...and something all 2007+ micro and monolithic kernels should have to yield for an event
@ -57,15 +56,11 @@ namespace Aurora::Threading
// bookkeeping (parent container)
bool bOverflow {};
bool bReleaseOnWake {};
bool TryAcquire(const void *pAddress, AuUInt8 uSize);
void Release();
bool SleepOn(WaitState &state);
bool TryWake(const void *pAddress);
bool TryWakeNoLock(const void *pAddress);
bool TryWakeNoLockNoReallyNoLock(const void *pAddress);
bool TrySignalAddress(const void *pAddress);
};
struct ProcessListWait