Alexandre Julliard : ntdll: Only return STATUS_USER_APC from a wait if a real user APC has been run.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 10 15:47:06 CST 2007


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jan 10 20:48:02 2007 +0100

ntdll: Only return STATUS_USER_APC from a wait if a real user APC has been run.

Based on a patch by Thomas Kho.

---

 dlls/ntdll/sync.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 1d07ba7..0cb604f 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -655,10 +655,11 @@ static int wait_reply( void *cookie )
 /***********************************************************************
  *              call_apcs
  *
- * Call outstanding APCs.
+ * Call outstanding APCs. Return TRUE if a user APC has been run.
  */
-static void call_apcs( BOOL alertable )
+static BOOL call_apcs( BOOL alertable )
 {
+    BOOL user_apc = FALSE;
     NTSTATUS ret;
     apc_call_t call;
     HANDLE handle = 0;
@@ -677,12 +678,13 @@ static void call_apcs( BOOL alertable )
         }
         SERVER_END_REQ;
 
-        if (ret) return;  /* no more APCs */
+        if (ret) return user_apc;  /* no more APCs */
 
         switch (call.type)
         {
         case APC_USER:
             call.user.func( call.user.args[0], call.user.args[1], call.user.args[2] );
+            user_apc = TRUE;
             break;
         case APC_TIMER:
         {
@@ -691,6 +693,7 @@ static void call_apcs( BOOL alertable )
             RtlSecondsSince1970ToTime( call.timer.time.sec, &time );
             time.QuadPart += call.timer.time.usec * 10;
             call.timer.func( call.timer.arg, time.u.LowPart, time.u.HighPart );
+            user_apc = TRUE;
             break;
         }
         case APC_ASYNC_IO:
@@ -733,8 +736,7 @@ NTSTATUS NTDLL_wait_for_multiple_objects
         SERVER_END_REQ;
         if (ret == STATUS_PENDING) ret = wait_reply( &cookie );
         if (ret != STATUS_USER_APC) break;
-        call_apcs( (flags & SELECT_ALERTABLE) != 0 );
-        if (flags & SELECT_ALERTABLE) break;
+        if (call_apcs( (flags & SELECT_ALERTABLE) != 0 )) break;
         signal_object = 0;  /* don't signal it multiple times */
     }
 




More information about the wine-cvs mailing list