What is equivalent of Win32’s WaitForMultipleObjects function in iOS?
This is roughly what I want:
NSCondition *condition1;
NSCondition *condition2;
NSCondition *condition3;
wait_for_conditions([NSArray arrayWithObjects: condition1, condition2, condition3, nil],
^{
// Some code which must be executed when all conditions were fired
});
// in some other places of program:
[condition1 signal];
// ...
[condition2 signal];
// ...
[condition3 signal];
What are the ways to accomplish this in iOS?
Edit: I’m not bound to usage of NSCondition, any other synchronization things will be ok (I’ve just googled and found NSCondition).
OK, I ended up using my own solution using GCD’s groups of blocks notifications. I’ve also used serial queue (instead of concurrent) which guarantees we create only 1 additional thread.