From 35f35f0d09372ce18a938942b0d87b9cc8f77833 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 24 May 2026 02:18:39 +0000 Subject: [PATCH] fx --- src/common/thread.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 08b266254c..2cf5cdf14e 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -231,11 +231,23 @@ bool Event::WaitFor(const std::chrono::nanoseconds time) { } #else bool Event::WaitFor(const std::chrono::nanoseconds time) { +#ifdef _WIN32 + auto const end = Common::g_wall_clock.GetTimeNS() + time; + while (!is_set.load() && rem > 0) { + Common::Windows::SleepForOneTick(); + if (Common::g_wall_clock.GetTimeNS() > end) + break; + } + 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 } #endif