Retry waiting if STATUS_ALERTED is returned

svn path=/trunk/; revision=17189
This commit is contained in:
Alex Ionescu 2005-08-07 23:22:18 +00:00
parent ae86070caa
commit 12de4ac145

View file

@ -90,7 +90,7 @@ WaitForSingleObjectEx(HANDLE hHandle,
Time.QuadPart = -10000 * (LONGLONG)dwMilliseconds; Time.QuadPart = -10000 * (LONGLONG)dwMilliseconds;
TimePtr = &Time; TimePtr = &Time;
} }
WaitAgain:
Status = NtWaitForSingleObject(hHandle, Status = NtWaitForSingleObject(hHandle,
(BOOLEAN) bAlertable, (BOOLEAN) bAlertable,
TimePtr); TimePtr);
@ -100,6 +100,7 @@ WaitForSingleObjectEx(HANDLE hHandle,
SetLastErrorByStatus (Status); SetLastErrorByStatus (Status);
return WAIT_FAILED; return WAIT_FAILED;
} }
if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
return Status; return Status;
} }
@ -210,20 +211,22 @@ WaitForMultipleObjectsEx(DWORD nCount,
TimePtr = &Time; TimePtr = &Time;
} }
WaitAgain:
Status = NtWaitForMultipleObjects (nCount, Status = NtWaitForMultipleObjects (nCount,
HandleBuffer, HandleBuffer,
bWaitAll ? WaitAll : WaitAny, bWaitAll ? WaitAll : WaitAny,
(BOOLEAN)bAlertable, (BOOLEAN)bAlertable,
TimePtr); TimePtr);
if (HandleBuffer != Handle)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer);
}
if (HIWORD(Status)) if (HIWORD(Status))
{ {
SetLastErrorByStatus (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; return Status;