From c9ced93936d95bcb5a2d675605ae7251c9099e62 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 23 May 2026 22:52:40 +0000 Subject: [PATCH] fix arm64 --- src/common/thread.cpp | 5 +++++ src/common/thread.h | 1 - src/common/x64/cpu_detect.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/thread.cpp b/src/common/thread.cpp index e1e7eb1b60..4ba962105e 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -216,6 +216,11 @@ bool Event::WaitFor(const std::chrono::nanoseconds time) { if (is_set.load()) Reset(); return true; +#elif defined(__FreeBSD__) + while (!is_set.load() && end > _rdtsc()) + _mm_pause(); + bool expected = true; + return is_set.compare_exchange_weak(expected, false, std::memory_order_release); #else std::unique_lock lk{mutex}; if (!condvar.wait_for(lk, time, [this] { return is_set.load(); })) diff --git a/src/common/thread.h b/src/common/thread.h index 5b3682f266..a75e342802 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -15,7 +15,6 @@ #include #include "common/common_types.h" #include "common/polyfill_thread.h" -#include "common/x64/rdtsc.h" namespace Common { diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index 4fae186bd5..cddcdba7a8 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp @@ -16,8 +16,10 @@ #include "common/bit_util.h" #include "common/common_types.h" #include "common/logging.h" +#ifdef ARCHITECTURE_x86_64 #include "common/x64/cpu_detect.h" #include "common/x64/rdtsc.h" +#endif #ifdef _WIN32 #include