[*] Adjust non-AURORA_RUNTIME_FORCE_ADAPTIVE_FUTEX futexes

This commit is contained in:
Reece Wilson 2023-09-06 16:08:41 +01:00
parent 213ed6c49b
commit 3d8dd991e0
3 changed files with 36 additions and 0 deletions

View File

@ -186,9 +186,21 @@ namespace Aurora::Threading::Waitables
#if (defined(AURORA_ARCH_X86) || defined(AURORA_ARCH_X64)) && !defined(AURORA_RUNTIME_FORCE_ADAPTIVE_FUTEX)
AuUInt uCount(GetTotalSpinCountTimeout());
#if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)
auto uPerfCounter = __rdtsc() + uCount;
while (__rdtsc() < uPerfCounter)
#else
for (AU_ITERATE_N(i, uCount))
#endif
{
#if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)
_mm_pause();
_mm_pause();
_mm_pause();
_mm_pause();
#else
// TBD
#endif
if (TryLock3())
{

View File

@ -34,9 +34,21 @@ namespace Aurora::Threading::Waitables
#if (defined(AURORA_ARCH_X86) || defined(AURORA_ARCH_X64)) && !defined(AURORA_RUNTIME_FORCE_ADAPTIVE_FUTEX)
AuUInt uCount(GetTotalSpinCountTimeout());
#if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)
auto uPerfCounter = __rdtsc() + uCount;
while (__rdtsc() < uPerfCounter)
#else
for (AU_ITERATE_N(i, uCount))
#endif
{
#if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)
_mm_pause();
_mm_pause();
_mm_pause();
_mm_pause();
#else
// TBD
#endif
if (TryLockNoSpin())
{

View File

@ -33,9 +33,21 @@ namespace Aurora::Threading::Waitables
#if (defined(AURORA_ARCH_X86) || defined(AURORA_ARCH_X64)) && !defined(AURORA_RUNTIME_FORCE_ADAPTIVE_FUTEX)
AuUInt uCount(GetTotalSpinCountTimeout());
#if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)
auto uPerfCounter = __rdtsc() + uCount;
while (__rdtsc() < uPerfCounter)
#else
for (AU_ITERATE_N(i, uCount))
#endif
{
#if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)
_mm_pause();
_mm_pause();
_mm_pause();
_mm_pause();
#else
// TBD
#endif
if (TryLockNoSpin())
{