Retry waiting if STATUS_ALERTED is returned
Modified: trunk/reactos/lib/kernel32/synch/wait.c

Modified: trunk/reactos/lib/kernel32/synch/wait.c
--- trunk/reactos/lib/kernel32/synch/wait.c	2005-08-07 23:19:15 UTC (rev 17188)
+++ trunk/reactos/lib/kernel32/synch/wait.c	2005-08-07 23:22:18 UTC (rev 17189)
@@ -90,7 +90,7 @@
       Time.QuadPart = -10000 * (LONGLONG)dwMilliseconds;
       TimePtr = &Time;
     }
-
+WaitAgain:
   Status = NtWaitForSingleObject(hHandle,
 				 (BOOLEAN) bAlertable,
 				 TimePtr);
@@ -100,6 +100,7 @@
       SetLastErrorByStatus (Status);
       return WAIT_FAILED;
     }
+  if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
 
   return Status;
 }
@@ -210,22 +211,24 @@
       TimePtr = &Time;
     }
 
+WaitAgain:
   Status = NtWaitForMultipleObjects (nCount,
 				     HandleBuffer,
 				     bWaitAll  ? WaitAll : WaitAny,
 				     (BOOLEAN)bAlertable,
 				     TimePtr);
-  if (HandleBuffer != Handle)
-    {
-      RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer);
-    }
-
   if (HIWORD(Status))
     {
       SetLastErrorByStatus (Status);
-      return WAIT_FAILED;
+      Status = WAIT_FAILED;
     }
+  if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
 
+  if (HandleBuffer != Handle)
+  {
+      RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer);
+  }
+
   return Status;
 }