From a3173188f8e0459425ee25ffbce31947ede648b5 Mon Sep 17 00:00:00 2001 From: lizzie Date: Tue, 26 May 2026 19:10:59 +0000 Subject: [PATCH] fix tomodachi dying --- src/common/thread.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 01a86e52a8..49f6f5cf98 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -173,6 +173,7 @@ __attribute__((target("waitpkg,mwaitx"))) #pragma GCC target("mwaitx") #endif bool Event::WaitFor(const std::chrono::nanoseconds time) { +#ifdef _WIN32 auto const start = Common::X64::FencedRDTSC(); auto const& caps = Common::g_cpu_caps; [[maybe_unused]] auto const end = start + Common::g_wall_clock.NsToTicks(time); @@ -212,20 +213,19 @@ bool Event::WaitFor(const std::chrono::nanoseconds time) { return true; } } else { -#ifdef _WIN32 while (!is_set.load() && end > _rdtsc()) Common::Windows::SleepForOneTick(); if (is_set.load()) Reset(); return true; -#else - std::unique_lock lk{mutex}; - if (!condvar.wait_for(lk, time, [this] { return is_set.load(); })) - return false; - is_set = false; - return true; -#endif } +#else + std::unique_lock lk{mutex}; + if (!condvar.wait_for(lk, time, [this] { return is_set.load(); })) + return false; + is_set = false; + return true; +#endif } #else bool Event::WaitFor(const std::chrono::nanoseconds time) {