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 8880251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:07:49+00:00 2026-06-14T20:07:49+00:00

i have four operations to be done as follows start actvityindicator. do some caclulations.

  • 0

i have four operations to be done as follows

  1. start actvityindicator.
  2. do some caclulations. (in bg thread)
  3. save the results in xml .(in bg thread)
  4. stop the actvityindicator.

Now I am doing these operations in GCD as follows.

[self showAlert];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
    [self calculateValues];

    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
        [utility createXMLWithName:name];

        dispatch_sync(dispatch_get_main_queue(), ^{
            [self hideAlert];
        });
    });
});

I want to confirm is this the right way to do this in GCD? I need the task 2 and 3 in bg and also task 3 should happen only after task 2 finishes. For that i put the task 2 and 3 in separate queues.

  • 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-14T20:07:50+00:00Added an answer on June 14, 2026 at 8:07 pm

    i think it will work but i am not sure this is the best approach.
    i have posted some article about concurrency programing you might find it interesting for you question , you could have a look. concurrency programming in objective C

    in general if you would like to be sure you run your thread only after other thread is finish his work you can use:
    [NSObject performSelector: onThread: withObject: waintUntilDone:YES]; .

    (you could use NSOperation but it seems like overhead for what you need )

    but in your case i don’t really understand why you need the second background thread for task 3, if you want to run it only when task 2 finish.
    couldn’t you just right task 2 and then 3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have four classes which share some arrangement of four properties. I have currently
I have an array of four operations which I want to match against an
I have four activities namely, Demo_tabActivity.java [main activity] Tabhost.java The below two activities are
i have four radio buttons , and i want to set a text for
I have four activities namely, Demo_tabActivity.java [main activity] Tabhost.java The below two activities are
i have four tables user-question contains two columns: questionID, userID, the questions that the
I have four tables. Three of them are tables with one key and they
i have four imageviews in a linear layout in such a manner that only
I have four different lists. headers , descriptions , short_descriptions and misc . I
I have four UINavigationControllers assigned each to a tab in a UITabBarController. Each UINavigationController

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.