[*] Linux clean up (?) (+typo)

This commit is contained in:
Reece Wilson 2023-12-23 03:10:17 +00:00
parent eb95aeeac7
commit 9c86d1c899
3 changed files with 15 additions and 21 deletions

View File

@ -28,7 +28,7 @@
* for the sake of porting modern applications. The aforementioned synchronization primitives
* are written with OS specific optimizations in mind, and therefore consider emulation bloat.
* bPreferEmulatedWakeOnAddress disables the emulation layer, if theres a reasonable native
* interfaces available.
* interface available.
* Defer to ThreadingConfig::bPreferEmulatedWakeOnAddress = !AuBuild::kIsNtDerived
***/
#pragma once

View File

@ -7,9 +7,6 @@
***/
#include <Source/RuntimeInternal.hpp>
#include "AuMutex.Generic.hpp"
#include <sys/syscall.h>
#include <linux/futex.h>
#include "SMTYield.hpp"
#if !defined(_AURUNTIME_GENERIC_MUTEX)
@ -72,6 +69,20 @@ namespace Aurora::Threading::Primitives
AuUInt64 uStart {};
AuUInt64 uEnd {};
if (this->TryLockNoSpin())
{
return true;
}
struct timespec tspec;
if (uTimeout != 0)
{
uStart = AuTime::SteadyClockNS();
uEnd = uStart + uTimeout;
Time::monoabsns2ts(&tspec, uEnd);
}
if (ThrdCfg::gPreferLinuxPrimitivesFutexNoSpin)
{
if (this->TryLockNoSpin())
@ -88,18 +99,6 @@ namespace Aurora::Threading::Primitives
}
AuAtomicAdd(&this->dwSleeping_, 1u);
//redundant: 8.2.3.8
//barrier();
struct timespec tspec;
if (uTimeout != 0)
{
uStart = AuTime::SteadyClockNS();
uEnd = uStart + uTimeout;
Time::monoabsns2ts(&tspec, uEnd);
}
while (!this->TryLockNoSpin())
{

View File

@ -180,11 +180,6 @@ namespace Aurora::Threading::Primitives
Time::monoabsns2ts(&tspec, uEnd);
}
if (this->TryLockHeavy())
{
return true;
}
AuAtomicAdd<AuUInt32>(&this->dwSleeping_, 1u);
while (!this->TryLockNoSpin())