[ros-diffs] [navaraf] 17478: Actually break out of the wait loops if we got alerted.

navaraf at svn.reactos.com navaraf at svn.reactos.com
Mon Aug 22 23:35:45 CEST 2005


Actually break out of the wait loops if we got alerted.
Modified: trunk/reactos/ntoskrnl/ke/wait.c
  _____  

Modified: trunk/reactos/ntoskrnl/ke/wait.c
--- trunk/reactos/ntoskrnl/ke/wait.c	2005-08-22 15:20:49 UTC (rev
17477)
+++ trunk/reactos/ntoskrnl/ke/wait.c	2005-08-22 21:35:41 UTC (rev
17478)
@@ -27,7 +27,7 @@

 
 /* FUNCTIONS
*****************************************************************/
 
-VOID
+BOOLEAN
 inline
 FASTCALL
 KiCheckAlertability(BOOLEAN Alertable,
@@ -44,6 +44,7 @@
             CurrentThread->Alerted[(int)WaitMode] = FALSE;
             DPRINT("Thread was Alerted\n");
             *Status = STATUS_ALERTED;
+            return TRUE;
 
         /* If there are User APCs Pending, then we can't really be
alertable */
         } else if
((!IsListEmpty(&CurrentThread->ApcState.ApcListHead[UserMode])) &&
@@ -52,13 +53,17 @@
             DPRINT("APCs are Pending\n");
             CurrentThread->ApcState.UserApcPending = TRUE;
             *Status = STATUS_USER_APC;
+            return TRUE;
         }
 
     /* If there are User APCs Pending and we are waiting in usermode,
then we must notify the caller */
     } else if ((CurrentThread->ApcState.UserApcPending) && (WaitMode !=
KernelMode)) {
             DPRINT("APCs are Pending\n");
             *Status = STATUS_USER_APC;
+            return TRUE;
     }
+
+    return FALSE;
 }
 
 /*
@@ -106,7 +111,8 @@
     do {
 
         /* We are going to wait no matter what (that's the point), so
test Alertability */
-        KiCheckAlertability(Alertable, CurrentThread, KernelMode,
&Status);
+        if (KiCheckAlertability(Alertable, CurrentThread, KernelMode,
&Status))
+            break;
 
         /* Set Timer */
         ThreadTimer = &CurrentThread->Timer;
@@ -256,7 +262,8 @@
         WaitBlock->NextWaitBlock = WaitBlock;
 
         /* Make sure we can satisfy the Alertable request */
-        KiCheckAlertability(Alertable, CurrentThread, WaitMode,
&Status);
+        if (KiCheckAlertability(Alertable, CurrentThread, WaitMode,
&Status))
+            break;
 
         /* Set the Wait Status */
         CurrentThread->WaitStatus = Status;
@@ -485,7 +492,8 @@
         }
 
         /* Make sure we can satisfy the Alertable request */
-        KiCheckAlertability(Alertable, CurrentThread, WaitMode,
&Status);
+        if (KiCheckAlertability(Alertable, CurrentThread, WaitMode,
&Status))
+            break;
 
         /* Set the Wait Status */
         CurrentThread->WaitStatus = Status;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050822/3090bd82/attachment.html


More information about the Ros-diffs mailing list