From f53508baa9431149a0035bd19f84635ed3914957 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Mon, 4 Sep 2023 23:03:08 +0100 Subject: [PATCH] [*] Unify both SMT subloops --- Source/Threading/Primitives/SMTYield.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Threading/Primitives/SMTYield.hpp b/Source/Threading/Primitives/SMTYield.hpp index ac67ea60..211ef63c 100644 --- a/Source/Threading/Primitives/SMTYield.hpp +++ b/Source/Threading/Primitives/SMTYield.hpp @@ -86,7 +86,12 @@ namespace Aurora::Threading::Primitives if (gHasThreadLocalTimeout) { int loops = (1 << tlsSpinCountLocal); + #if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86) + auto perfCounter = __rdtsc() + loops; + while (__rdtsc() < perfCounter) + #else while (loops > 0) + #endif { if (callback()) { @@ -162,7 +167,12 @@ namespace Aurora::Threading::Primitives auto uCount = tlsSpinCountLocal; int loops = (1 << uCount); + #if defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86) + auto perfCounter = __rdtsc() + loops; + while (__rdtsc() < perfCounter) + #else while (loops > 0) + #endif { if (callback()) {