WaitForMultipleObjects () reset all events auto- reset?

I have an event loop waiting for several auto-reset events. All events were initialized to the eventHandles_ array using 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 is: if events 1 and 2 happen simultaneously, the loop will process WAIT_OBJECT_0 + 1 , because it is the first. But will event 2 remain a signal when the loop reappears? Or does it automatically get reset?

+6
source share
1 answer

"... modification occurs only for an object or objects whose alarm state caused a 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 :

When waiting for one event, only this event changes. If you expect for all events, then they are all changed. What documentation means "object or objects." Singular, if you wait - any, plural, if you wait - that's it.

+5
source

Source: https://habr.com/ru/post/911136/


All Articles