[*] Removed redundant branches from AuThreadPrimitives

This commit is contained in:
Reece Wilson 2024-01-21 21:15:57 +00:00
parent 98e76f0832
commit 34e49d2d10
6 changed files with 15 additions and 42 deletions

View File

@ -133,14 +133,7 @@ namespace Aurora::Threading::Primitives
uEndTime = AuTime::SteadyClockNS() + uTimeout;
}
if (ThrdCfg::gPreferUnixPrimitivesNoSpin)
{
if (this->TryLockNoSpin())
{
return true;
}
}
else
if (!ThrdCfg::gPreferUnixPrimitivesNoSpin)
{
if (this->TryLockHeavy())
{

View File

@ -58,14 +58,7 @@ namespace Aurora::Threading::Primitives
Time::monoabsns2ts(&tspec, uTimeout);
}
if (ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockNoSpin())
{
return true;
}
}
else
if (!ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockHeavy())
{

View File

@ -114,7 +114,7 @@ namespace Aurora::Threading::Primitives
{
bool bStatus { true };
if (ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
if (ThrdCfg::gPreferUnixPrimitivesNoSpin)
{
if (this->TryLockNoSpin())
{

View File

@ -83,14 +83,7 @@ namespace Aurora::Threading::Primitives
Time::monoabsns2ts(&tspec, uEnd);
}
if (ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockNoSpin())
{
return true;
}
}
else
if (!ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockHeavy())
{
@ -161,14 +154,7 @@ namespace Aurora::Threading::Primitives
Time::monoabsns2ts(&tspec, uTimeout);
}
if (ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockNoSpin())
{
return true;
}
}
else
if (!ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockHeavy())
{

View File

@ -144,7 +144,15 @@ namespace Aurora::Threading::Primitives
{
static const AuUInt32 kRef { 0 };
while (!TryLock())
if (!ThrdCfg::gPreferUnixPrimitivesNoSpin)
{
if (this->TryLockHeavy())
{
return true;
}
}
while (!TryLockNoSpin())
{
bool bStatus {};

View File

@ -84,14 +84,7 @@ namespace Aurora::Threading::Primitives
Time::monoabsns2ts(&tspec, uEnd);
}
if (ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockNoSpin())
{
return true;
}
}
else
if (!ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockHeavy())
{