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

  • Home
  • SEARCH
  • 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 9268719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:55:49+00:00 2026-06-18T14:55:49+00:00

I have to do a IO operation which might take long to complete. The

  • 0

I have to do a IO operation which might take long to complete. The IO oeration is invoked from a button.
Ofcourse the UI hangs untill the operation completes. So I suppose I need to do IO on some background thread, but when the operation completes I have to update window’s labels to signal the operation complete. Which I suppose I should be doing on the main thread (like EDT in java and similar in C#) , correct ?

in C# there is class something like TaskAsync and similar in Java android. Which lets you complete the long task in another thread and the when the task is complete a handler is called on main thread , so that UI can be updated on main thread,

What exactly does cocoa has to do similar task, that is allow a long operation on seperate thread than main and then somehow facilitate to update the userinterface on main thread.

  • 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-18T14:55:50+00:00Added an answer on June 18, 2026 at 2:55 pm

    Assuming you have a handle to the view controller where you want to update the UI, you could use the NSObject “performSelectorOnMainThread:withObject:waitUntilDone:” method.

    2) you could also utilize Grand Central Dispatch with code like this:

    dispatch_async(dispatch_get_main_queue(), ^{
        [viewController doSomethingWhenBigOperationIsDone];
    }); 
    

    3)
    Or you could even post an NSNotification from your background thread where the observer (in the main thread) could update the UI.

    You might find some additional useful information in this related question.

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

Sidebar

Related Questions

I have a reoccuring operation which composed of build somekind of key/value pairs. the
I have a WCF service which performs CRUD operation on my data model: Add,
I have a web application which needs to perform a file copy operation and
I have a program which needs to invoke a process to perform an operation
I need a query which can do the following operation. I have a table
I have a listview which I populate from a webservice query. Problem is that
I have a set of n consecutive operations which each one runs in O(1)
I have some Java code which performs bitwise operations on a BitSet. I have
I have a custom control which displays results of some operations. It is hidden
I have various class which perform save and update operations of GUI elements, it

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.