[PATCH 4/5] ntdll: Call usleep() instead of NtYieldExecution() in NtDelayExecution().

Matteo Bruni mbruni at codeweavers.com
Fri Nov 19 13:50:29 CST 2021


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>
---
 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 137d8d2c87d..58fcc913fb7 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 (;;)
-- 
2.26.3




More information about the wine-devel mailing list