I've got an event loop that's waiting on several auto-reset events.
The events were all initialized into array eventHandles_
with CreateEvent(NULL, false, false, NULL)
.
while (true)
{
DWORD waitResult = WaitForMultipleObjects(3, eventHandles_, false, INFINITE);
switch (waitResult)
{
case WAIT_OBJECT_0 + 0:
//handle event...
case WAIT_OBJECT_0 + 1:
//handle event...
case WAIT_OBJECT_0 + 2:
//handle event...
}
}
My question: if event 1 and 2 occur simultaneously, the loop will process WAIT_OBJECT_0 + 1
because it's first. But will event 2 remain signaled when the loop comes around again? Or does it get reset automatically?
"...modification occurs only for the object or objects whose signaled state caused the function to return..."
http://msdn.microsoft.com/en-us/library/windows/desktop/ms687025(v=vs.85).aspx
And from the mouth of one Raymond Chen:
If waiting for one event, then only that event is modified. If waiting for all events, then all are modified. That's what the documentation means by "object or objects". Singular if wait-any, plural if wait-all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With