[*] RWLock: revert this branch to checking for 0 and 1 remaining readers

[*] Formatting
This commit is contained in:
Reece Wilson 2023-08-21 16:06:00 +01:00
parent e2909ebe74
commit 681c4b9158

View File

@ -241,7 +241,7 @@ namespace Aurora::Threading::Primitives
template<bool bIsWriteRecursionAllowed>
bool RWLockImpl<bIsWriteRecursionAllowed>::LockWriteNSAbs(AuUInt64 uTimeout)
{
if constexpr (!bIsWriteRecursionAllowed)
if constexpr (!bIsWriteRecursionAllowed)
{
if (TryLockWrite())
{
@ -475,7 +475,13 @@ namespace Aurora::Threading::Primitives
uVal = AuAtomicSub(&this->state_, 1);
if (uVal == 0)
bool bAlt {};
if constexpr (bIsWriteRecursionAllowed)
{
bAlt = uVal == 1;
}
if (uVal == 0 || bAlt)
{
bool bElevation {};
@ -629,6 +635,7 @@ namespace Aurora::Threading::Primitives
{
return &this->read_;
}
template<bool bIsWriteRecursionAllowed>
IWaitable *RWLockImpl<bIsWriteRecursionAllowed>::AsWritable()
{