[+] ThreadingConfig::bPreferRWLockReadLockSpin
This commit is contained in:
parent
e1f384de2e
commit
f847ab049a
@ -361,6 +361,7 @@ namespace Aurora
|
||||
AuUInt64 bPreferLinuxMutexSpinTryLock : 1 { true };
|
||||
AuUInt64 bPreferLinuxCondMutexSpinTryLock : 1 { true };
|
||||
AuUInt64 bPreferEmulatedWakeOnAddress : 1 { false };
|
||||
AuUInt64 bPreferRWLockReadLockSpin : 1 { true };
|
||||
};
|
||||
|
||||
struct DummyConfig
|
||||
|
@ -141,7 +141,7 @@ namespace Aurora::Threading::Primitives
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
bool RWLockImpl<bIsWriteRecursionAllowed>::LockReadNSAbs(AuUInt64 uTimeout)
|
||||
{
|
||||
if (this->TryLockReadNoSpin())
|
||||
if (this->TryLockRead())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -197,6 +197,11 @@ namespace Aurora::Threading::Primitives
|
||||
|
||||
AuInt64 uEndTime = uTimeout ? AuTime::SteadyClockNS() + uTimeout : 0;
|
||||
|
||||
if (this->TryLockRead())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
AuInt32 iCurState {};
|
||||
do
|
||||
{
|
||||
@ -421,10 +426,17 @@ namespace Aurora::Threading::Primitives
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
bool RWLockImpl<bIsWriteRecursionAllowed>::TryLockRead()
|
||||
{
|
||||
return DoTryIf([=]()
|
||||
if (gRuntimeConfig.threadingConfig.bPreferRWLockReadLockSpin)
|
||||
{
|
||||
return DoTryIf([=]()
|
||||
{
|
||||
return TryLockReadNoSpin();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return TryLockReadNoSpin();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
template<bool bIsWriteRecursionAllowed>
|
||||
|
Loading…
Reference in New Issue
Block a user