Wait for a specified amount of objects?
-
05-07-2019 - |
Question
- Using WaitForMultipleObjects:
- Makes it possible, to wait for one or all of specified objects to change to a singled state
Question:
- How can one wait for a specified amount - such as
5
, for example
Usage
dwEvent = WaitForMultipleObjects(
maxExpectedConnections,
ghEventsA,
TRUE,//but wait for a specified number instead
INFINITE);
Solution
Use the waitall flag to indicate that you want the wait to return when any object is signalled. When wait returns, remove the signalled object from the array of objects and wait again until you have N (e.g. 5 in your case) signalled objects.
OTHER TIPS
You could just wait several times for a single object each, until you have collected as many "ready" objects as you want.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow