[*] RWLock: I didn't like what I saw emitted
This commit is contained in:
parent
22a4d3383d
commit
410a67d842
@ -304,6 +304,11 @@ namespace Aurora::Threading::Primitives
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
bool RWLockImpl<bIsWriteRecursionAllowed>::TryLockWriteMaybeSpin()
|
||||
{
|
||||
if (this->TryLockWriteNoSpin())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gUseFutexRWLock)
|
||||
{
|
||||
if (DoTryIf([=]()
|
||||
@ -314,13 +319,6 @@ namespace Aurora::Threading::Primitives
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->TryLockWriteNoSpin())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -606,6 +604,11 @@ namespace Aurora::Threading::Primitives
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
bool RWLockImpl<bIsWriteRecursionAllowed>::TryLockRead()
|
||||
{
|
||||
if (this->TryLockReadNoSpin<true>())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ThrdCfg::gPreferRWLockReadLockSpin &&
|
||||
AuAtomicLoad(&this->dwWritersPending_) == 0)
|
||||
{
|
||||
@ -614,10 +617,8 @@ namespace Aurora::Threading::Primitives
|
||||
return this->TryLockReadNoSpin<true>();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return this->TryLockReadNoSpin<true>();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
@ -729,21 +730,9 @@ namespace Aurora::Threading::Primitives
|
||||
{
|
||||
if (this->iState_ == 1)
|
||||
{
|
||||
if (gUseFutexRWLock)
|
||||
if (this->UpgradeReadToWriteDoUpgrade())
|
||||
{
|
||||
if (this->UpgradeReadToWriteDoUpgrade())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RWLockAcquire;
|
||||
|
||||
if (this->UpgradeReadToWriteDoUpgrade())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace Aurora::Threading::Primitives
|
||||
struct RWLockImpl;
|
||||
|
||||
template<bool bIsReadView, typename T>
|
||||
struct RWLockAccessView : IWaitable
|
||||
struct RWLockAccessView final : IWaitable
|
||||
{
|
||||
#if defined(RWLOCK_VIEW_HAS_PARENT)
|
||||
RWLockAccessView(T &impl) :
|
||||
|
Loading…
Reference in New Issue
Block a user