mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
use loops instead of gotos
svn path=/trunk/; revision=17192
This commit is contained in:
parent
afcb29cc7c
commit
e41e25c1e1
1 changed files with 37 additions and 30 deletions
|
@ -90,17 +90,20 @@ WaitForSingleObjectEx(HANDLE hHandle,
|
|||
Time.QuadPart = -10000 * (LONGLONG)dwMilliseconds;
|
||||
TimePtr = &Time;
|
||||
}
|
||||
WaitAgain:
|
||||
Status = NtWaitForSingleObject(hHandle,
|
||||
(BOOLEAN) bAlertable,
|
||||
TimePtr);
|
||||
|
||||
if (HIWORD(Status))
|
||||
do
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
return WAIT_FAILED;
|
||||
}
|
||||
if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
|
||||
Status = NtWaitForSingleObject(hHandle,
|
||||
(BOOLEAN) bAlertable,
|
||||
TimePtr);
|
||||
|
||||
if (HIWORD(Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
return WAIT_FAILED;
|
||||
}
|
||||
|
||||
} while (Status == STATUS_ALERTED && bAlertable);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -211,18 +214,20 @@ WaitForMultipleObjectsEx(DWORD nCount,
|
|||
TimePtr = &Time;
|
||||
}
|
||||
|
||||
WaitAgain:
|
||||
Status = NtWaitForMultipleObjects (nCount,
|
||||
HandleBuffer,
|
||||
bWaitAll ? WaitAll : WaitAny,
|
||||
(BOOLEAN)bAlertable,
|
||||
TimePtr);
|
||||
if (HIWORD(Status))
|
||||
do
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
Status = WAIT_FAILED;
|
||||
}
|
||||
if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
|
||||
Status = NtWaitForMultipleObjects (nCount,
|
||||
HandleBuffer,
|
||||
bWaitAll ? WaitAll : WaitAny,
|
||||
(BOOLEAN)bAlertable,
|
||||
TimePtr);
|
||||
if (HIWORD(Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
Status = WAIT_FAILED;
|
||||
}
|
||||
|
||||
} while (Status == STATUS_ALERTED && bAlertable);
|
||||
|
||||
if (HandleBuffer != Handle)
|
||||
{
|
||||
|
@ -283,17 +288,19 @@ SignalObjectAndWait(HANDLE hObjectToSignal,
|
|||
TimePtr = &Time;
|
||||
}
|
||||
|
||||
WaitAgain:
|
||||
Status = NtSignalAndWaitForSingleObject (hObjectToSignal,
|
||||
hObjectToWaitOn,
|
||||
(BOOLEAN)bAlertable,
|
||||
TimePtr);
|
||||
if (!NT_SUCCESS(Status))
|
||||
do
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
return WAIT_FAILED;
|
||||
}
|
||||
if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
|
||||
Status = NtSignalAndWaitForSingleObject (hObjectToSignal,
|
||||
hObjectToWaitOn,
|
||||
(BOOLEAN)bAlertable,
|
||||
TimePtr);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
return WAIT_FAILED;
|
||||
}
|
||||
|
||||
} while (Status == STATUS_ALERTED && bAlertable);
|
||||
|
||||
/* STATUS_SUCCESS maps to WAIT_OBJECT_0 */
|
||||
return Status;
|
||||
|
|
Loading…
Reference in a new issue