Since some people have different interpretation of the documentation, I'm trying to clarify once and for all the return value of WaitForMultipleObjects when
bWaitAll = TRUE
.- all handles were signaled
Based on the documnation:
Return value
WAIT_OBJECT_0 to (WAIT_OBJECT_0 + nCount– 1)
If bWaitAll is TRUE, the return value indicates that the state of all specified objects is signaled.
Question
Say I have passed 5 handles to this function and all of them were signaled, is the return value WAIT_OBJECT_0
?
Note
I'm trying to verify programmatically that WaitForMultipleObjects
succeeded.
DWORD dwWaitForMultipleObjectsRes = WaitForMultipleObjects(dwOpenProcessCount, handles, TRUE, m_dwWaitTimeForProcToBeKilled);
if (dwWaitForMultipleObjectsRes != WAIT_OBJECT_0)
// failed?
I want to verify the condition correctness.
WaitForMultipleObjects
succeeded? – idanshmubWaitAll
would beFALSE
and all objects had signalled then the function had to returnWAIT_OBJECT_0
as it's the smallest value. So it's quite probable thatbWaitAll=TRUE
would yield the same result in practice. Yet the docs do not state it must do this way. So one shouldn't rely on it. – Matt