ntdll/kernel32: #16

Eric Pouech pouech-eric at wanadoo.fr
Thu Apr 3 14:33:41 CST 2003


- no longer call WaitFor*Object* from ntdll (but NtWait*Object*)

A+
-- 
Eric Pouech
-------------- next part --------------
diff -u -x '*~' -x '.#*' dlls/ntdll15/critsection.c dlls/ntdll/critsection.c
--- dlls/ntdll15/critsection.c	2003-03-21 18:30:05.000000000 +0100
+++ dlls/ntdll/critsection.c	2003-04-03 22:05:17.000000000 +0200
@@ -146,23 +146,32 @@
     {
         EXCEPTION_RECORD rec;
         HANDLE sem = get_semaphore( crit );
+        LARGE_INTEGER time;
+        DWORD status;
 
-        DWORD res = WaitForSingleObject( sem, 5000L );
-        if ( res == WAIT_TIMEOUT )
+        time.QuadPart = 5000L * (ULONGLONG)10000;
+        time.QuadPart = -time.QuadPart;
+
+        status = NtWaitForSingleObject( sem, FALSE, &time );
+        if ( status == WAIT_TIMEOUT )
         {
             const char *name = (char *)crit->DebugInfo;
             if (!name) name = "?";
             ERR( "section %p %s wait timed out, retrying (60 sec) tid=%04lx\n",
                  crit, debugstr_a(name), GetCurrentThreadId() );
-            res = WaitForSingleObject( sem, 60000L );
-            if ( res == WAIT_TIMEOUT && TRACE_ON(relay) )
+            time.QuadPart = 60000L * (ULONGLONG)10000;
+            time.QuadPart = -time.QuadPart;
+            status = NtWaitForSingleObject( sem, FALSE, &time );
+            if ( status == WAIT_TIMEOUT && TRACE_ON(relay) )
             {
                 ERR( "section %p %s wait timed out, retrying (5 min) tid=%04lx\n",
                      crit, debugstr_a(name), GetCurrentThreadId() );
-                res = WaitForSingleObject( sem, 300000L );
+                time.QuadPart = 300000 * (ULONGLONG)10000;
+                time.QuadPart = -time.QuadPart;
+                status = NtWaitForSingleObject( sem, FALSE, &time );
             }
         }
-        if (res == STATUS_WAIT_0) return STATUS_SUCCESS;
+        if (status == STATUS_WAIT_0) return STATUS_SUCCESS;
 
         /* Throw exception only for Wine internal locks */
         if (!crit->DebugInfo) continue;
diff -u -x '*~' -x '.#*' dlls/ntdll15/rtl.c dlls/ntdll/rtl.c
--- dlls/ntdll15/rtl.c	2003-03-22 08:27:22.000000000 +0100
+++ dlls/ntdll/rtl.c	2003-04-03 22:06:07.000000000 +0200
@@ -166,7 +166,7 @@
 	     rwl->uExclusiveWaiters++;
 
 	     RtlLeaveCriticalSection( &rwl->rtlCS );
-	     if( WaitForSingleObject( rwl->hExclusiveReleaseSemaphore, INFINITE ) == WAIT_FAILED )
+	     if( NtWaitForSingleObject( rwl->hExclusiveReleaseSemaphore, FALSE, NULL ) == WAIT_FAILED )
 		 goto done;
 	     goto start; /* restart the acquisition to avoid deadlocks */
 	 }
@@ -206,7 +206,7 @@
 	{
 	    rwl->uSharedWaiters++;
 	    RtlLeaveCriticalSection( &rwl->rtlCS );
-	    if( (dwWait = WaitForSingleObject( rwl->hSharedReleaseSemaphore, INFINITE )) == WAIT_FAILED )
+	    if( (dwWait = NtWaitForSingleObject( rwl->hSharedReleaseSemaphore, FALSE, NULL )) == WAIT_FAILED )
 		goto done;
 	    goto start;
 	}
diff -u -x '*~' -x '.#*' dlls/ntdll15/signal_i386.c dlls/ntdll/signal_i386.c
--- dlls/ntdll15/signal_i386.c	2003-03-28 20:16:00.000000000 +0100
+++ dlls/ntdll/signal_i386.c	2003-04-03 22:08:47.000000000 +0200
@@ -1125,9 +1125,12 @@
  */
 static HANDLER_DEF(usr1_handler)
 {
+    LARGE_INTEGER timeout;
+
     init_handler( HANDLER_CONTEXT );
     /* wait with 0 timeout, will only return once the thread is no longer suspended */
-    WaitForMultipleObjectsEx( 0, NULL, FALSE, 0, FALSE );
+    timeout.QuadPart = 0;
+    NtWaitForMultipleObjects( 0, NULL, FALSE, FALSE, &timeout );
 }
 
 
diff -u -x '*~' -x '.#*' dlls/ntdll15/signal_powerpc.c dlls/ntdll/signal_powerpc.c
--- dlls/ntdll15/signal_powerpc.c	2003-03-22 08:27:22.000000000 +0100
+++ dlls/ntdll/signal_powerpc.c	2003-04-03 22:09:03.000000000 +0200
@@ -409,8 +409,11 @@
  */
 static HANDLER_DEF(usr1_handler)
 {
+    LARGE_INTEGER timeout;
+
     /* wait with 0 timeout, will only return once the thread is no longer suspended */
-    WaitForMultipleObjectsEx( 0, NULL, FALSE, 0, FALSE );
+    timeout.QuadPart = 0;
+    NtWaitForMultipleObjects( 0, NULL, FALSE, FALSE, &timeout );
 }
 
 
diff -u -x '*~' -x '.#*' dlls/ntdll15/signal_sparc.c dlls/ntdll/signal_sparc.c
--- dlls/ntdll15/signal_sparc.c	2003-03-22 08:27:22.000000000 +0100
+++ dlls/ntdll/signal_sparc.c	2003-04-03 22:08:54.000000000 +0200
@@ -384,8 +384,11 @@
  */
 static HANDLER_DEF(usr1_handler)
 {
+    LARGE_INTEGER timeout;
+
     /* wait with 0 timeout, will only return once the thread is no longer suspended */
-    WaitForMultipleObjectsEx( 0, NULL, FALSE, 0, FALSE );
+    timeout.QuadPart = 0;
+    NtWaitForMultipleObjects( 0, NULL, FALSE, FALSE, &timeout );
 }
 
 


More information about the wine-patches mailing list