I am using WaitForMultipleObject function with waitForAll parameter = true. Here using a std::vector of handle object to wait for. If this function is timed out, then how can i identify that waiting on which handle is timed out??.
if(WAIT_OBJECT != WaitForMultipleObject(vector.size(), vector.data(), true, 16000))
{
//get the event that causes the wait to time out(assume that only one object is timed out.others are successfully set.)
}
According to MSDN’s
WaitForMultipleObjectsfunction definition:So, you just need to check: if the function succeeded – it’s all OK, if not, than check what kind of handles were in the array and the ones which weren’t. Thus you can figure out the problematic handle.
Also, I suggest you take a look at the
SignalObjectAndWaitfunction. Its behaviour is different, but maybe you will find it useful in some cases.