[PATCH 4/4] ntdll: Update user_shared_data timestamps after NtDelayExecution.

Rémi Bernon rbernon at codeweavers.com
Fri Nov 29 03:24:01 CST 2019


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29168
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/ntdll/sync.c       | 16 ++++++++++------
 dlls/ntdll/tests/time.c |  1 -
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 35b89df52ed..f241b9c2669 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -1146,11 +1146,14 @@ NTSTATUS WINAPI NtYieldExecution(void)
  */
 NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeout )
 {
+    NTSTATUS status = STATUS_SUCCESS;
+
     /* if alertable, we need to query the server */
     if (alertable)
-        return server_select( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, timeout );
-
-    if (!timeout || timeout->QuadPart == TIMEOUT_INFINITE)  /* sleep forever */
+    {
+        status = server_select( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, timeout );
+    }
+    else if (!timeout || timeout->QuadPart == TIMEOUT_INFINITE)  /* sleep forever */
     {
         for (;;) select( 0, NULL, NULL, NULL, NULL );
     }
@@ -1167,11 +1170,10 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou
 
         /* Note that we yield after establishing the desired timeout */
         NtYieldExecution();
-        if (!when) return STATUS_SUCCESS;
-
         for (;;)
         {
             struct timeval tv;
+            if (!when) break;
             NtQuerySystemTime( &now );
             diff = (when - now.QuadPart + 9) / 10;
             if (diff <= 0) break;
@@ -1180,7 +1182,9 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou
             if (select( 0, NULL, NULL, NULL, &tv ) != -1) break;
         }
     }
-    return STATUS_SUCCESS;
+
+    user_shared_data_update();
+    return status;
 }
 
 
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index eb7b5bf8890..251e3936fb6 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.c
@@ -172,7 +172,6 @@ static void test_NtGetTickCount(void)
     {
         diff = (user_shared_data->u.TickCountQuad * user_shared_data->TickCountMultiplier) >> 24;
         diff = pNtGetTickCount() - diff;
-        todo_wine
         ok(diff < 32, "NtGetTickCount - TickCountQuad too high, expected < 32 got %d\n", diff);
         Sleep(50);
     }
-- 
2.24.0




More information about the wine-devel mailing list