[-] hadnt fully removed the aggressive context switch thing from the old rwlock impl

This commit is contained in:
Reece Wilson 2023-12-30 21:58:52 +00:00
parent 63f5ad3fd5
commit 6037d14674
2 changed files with 0 additions and 52 deletions

View File

@ -304,13 +304,6 @@ namespace Aurora::Threading::Primitives
template<bool bIsWriteRecursionAllowed>
bool RWLockImpl<bIsWriteRecursionAllowed>::TryLockWriteMaybeSpin()
{
#if 0
if constexpr (!bIsWriteRecursionAllowed)
{
return this->TryLockWriteScatterSwitch();
}
#endif
if (gUseFutexRWLock)
{
if (DoTryIf([=]()
@ -650,50 +643,6 @@ namespace Aurora::Threading::Primitives
return AuAtomicCompareExchange(&this->iState_, iCurState + 1, iCurState) == iCurState;
}
template<bool bIsWriteRecursionAllowed>
bool RWLockImpl<bIsWriteRecursionAllowed>::TryLockWriteScatterSwitch()
{
for (AU_ITERATE_N(i, kRWThreadWriterHardContextSwitchBias))
{
auto curVal = this->iState_;
if (curVal < 0)
{
if constexpr (!bIsWriteRecursionAllowed)
{
AuThreading::ContextYield();
continue;
}
else
{
if (this->reentrantWriteLockHandle_ == GetThreadCookie())
{
AuAtomicSub(&this->iState_, 1);
return true;
}
else
{
AuThreading::ContextYield();
continue;
}
}
}
if (curVal != 0)
{
continue;
}
if (AuAtomicCompareExchange(&this->iState_, -1, curVal) == curVal)
{
this->reentrantWriteLockHandle_ = GetThreadCookie();
return true;
}
}
return false;
}
template<bool bIsWriteRecursionAllowed>
void RWLockImpl<bIsWriteRecursionAllowed>::UnlockRead()

View File

@ -71,7 +71,6 @@ namespace Aurora::Threading::Primitives
auline bool TryLockRead();// override;
template<bool bCheckWrite>
auline bool TryLockReadNoSpin();
auline bool TryLockWriteScatterSwitch();// override;
auline void UnlockRead();// override;
auline void UnlockWrite();// override;