[*] TryLockRead was unware of RWRenterableLocks specifications
(not an issue for regular blocking lock paths)
This commit is contained in:
parent
8dcf857da5
commit
36dee459ca
@ -7,6 +7,7 @@
|
||||
***/
|
||||
#include <Source/RuntimeInternal.hpp>
|
||||
#include "AuRWLock.hpp"
|
||||
#include "SMTYield.hpp"
|
||||
|
||||
namespace Aurora::Threading::Primitives
|
||||
{
|
||||
@ -210,14 +211,17 @@ namespace Aurora::Threading::Primitives
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
bool RWLockImpl<bIsWriteRecursionAllowed>::TryLockRead()
|
||||
{
|
||||
auto iCurState = this->state_;
|
||||
|
||||
if (iCurState == -1)
|
||||
return DoTryIf([=]()
|
||||
{
|
||||
return this->reentrantWriteLockHandle_ == GetThreadCookie();
|
||||
}
|
||||
auto iCurState = this->state_;
|
||||
|
||||
return AuAtomicCompareExchange(&this->state_, iCurState + 1, iCurState) == iCurState;
|
||||
if (iCurState < 0)
|
||||
{
|
||||
return this->reentrantWriteLockHandle_ == GetThreadCookie();
|
||||
}
|
||||
|
||||
return AuAtomicCompareExchange(&this->state_, iCurState + 1, iCurState) == iCurState;
|
||||
});
|
||||
}
|
||||
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
|
Loading…
Reference in New Issue
Block a user