Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:41:15+00:00 2026-06-04T07:41:15+00:00

What is equivalent of Win32’s WaitForMultipleObjects function in iOS? This is roughly what I

  • 0

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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:41:16+00:00Added an answer on June 4, 2026 at 7:41 am

    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.

    @interface WaitCondition : NSObject
        - (void) fire;
    @end
    
    @implementation WaitCondition {
        BOOL fired;
        NSCondition *condition;
    }
    
    - (id) init
    {
        if ((self = [super init])) {
            condition = [NSCondition new];
        }
        return self;
    }
    
    - (void) fire
    {
        [condition lock];
        [condition signal];
        fired = YES;
        [condition unlock];
    }
    
    - (void) wait
    {
        [condition lock];
        while (!fired) {
            [condition wait];
        }
        [condition unlock];
    }
    
    @end
    
    void Dispatch_NotifyForConditions(NSArray *conditions, dispatch_block_t completion)
    {
        dispatch_queue_t queue = dispatch_queue_create("notify_queue", NULL);
        dispatch_group_t group = dispatch_group_create();
    
        for (WaitCondition *condition in conditions)
        {
            NSCAssert([condition isKindOfClass:[WaitCondition class]], @"Dispatch_NotifyForConditions: conditions must contain WaitCondition objects only.");
            dispatch_group_async(group, queue, ^{
                [condition wait];
            });
        }
    
        dispatch_group_notify(group, queue, completion);
    
        dispatch_release(queue);
        dispatch_release(group);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This Microsoft support page shows that there is no Win32 equivalent to C Run-Time's
Is there a rough equivalent to the Linux/Unix stdio.h popen() function in the Win32
What would be the most elegant way to implement a Win32 equivalent of WaitForMultipleObjects
Is there a Win32 equivalent to the linux header file? I'm working on a
I'm looking for a Win32 equivalent of the .Net Encoding.GetEncoding Method to be used
Is there a Thread-Local Storage (TLS) equivalent for kernel-mode drivers in Windows (Win32 to
I want to make my Win32 C++ application able to be played on any
Equivalent (roughly) of setCurrent() in BlackBerry()? I have some J2ME code I am porting
I am trying to figure out the Win32 API (MFC) equivalent to SystemInformation.CaptionHeight in
Would anyone know what the Win32 equivalent of opendir is (or if it even

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.