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