From 1376a73c55863a9075bba347393e63bf47cd18d3 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:36:28 +0300 Subject: [PATCH] Special case Sleep(0) to yield on Linux. --- UnleashedRecomp/kernel/imports.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/kernel/imports.cpp b/UnleashedRecomp/kernel/imports.cpp index cffd6136..7546cf13 100644 --- a/UnleashedRecomp/kernel/imports.cpp +++ b/UnleashedRecomp/kernel/imports.cpp @@ -524,7 +524,10 @@ uint32_t KeDelayExecutionThread(uint32_t WaitMode, bool Alertable, be* #ifdef _WIN32 Sleep(timeout); #else - std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); + if (timeout == 0) + std::this_thread::yield(); + else + std::this_thread::sleep_for(std::chrono::milliseconds(timeout)); #endif return STATUS_SUCCESS;