Matteo Bruni : ntdll: Call usleep() instead of NtYieldExecution() in NtDelayExecution().

Alexandre Julliard julliard at winehq.org
Mon Nov 22 16:05:16 CST 2021


Module: wine
Branch: master
Commit: e86b4015ff405d4c054b8a5bc855ee655e1a833c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e86b4015ff405d4c054b8a5bc855ee655e1a833c

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Fri Nov 19 20:50:29 2021 +0100

ntdll: Call usleep() instead of NtYieldExecution() in NtDelayExecution().

This implements the general fix from
b1a79c6b9c3ada0c34b1411b60879962f1815e4d (in particular, making sure
that Sleep(0) will not immediately resume execution of the thread if
there are no other runnable threads) while preserving the existing
behavior of NtYieldExecution() / SwitchToThread(). Thanks Rémi for the
idea.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index 829add0be2d..d5d92145503 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -1480,7 +1480,7 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou
         }
 
         /* Note that we yield after establishing the desired timeout */
-        NtYieldExecution();
+        usleep(0);
         if (!when) return STATUS_SUCCESS;
 
         for (;;)




More information about the wine-cvs mailing list