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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:03:34+00:00 2026-05-22T23:03:34+00:00

I am new to programming. I am porting cpp (WIN32) to cocoa framework. I

  • 0

I am new to programming. I am porting cpp (WIN32) to cocoa framework. I have a method called start(process) from where 2 methods gets called. I want to do the operation in it parallely.I want to do InterThread communication.

This can be done by performSelectorOnMainThread:withObject:waitUntilDone.

Here I need to call the 2nd thread first and the 1st thread is called second.The 2nd thread waits for the 1st thread’s signal.(eg:1st thread does addition of two no’s and 2nd thread does the display and some other operations)

[receiverobj performSelectorOnMainThread:withObject:waitUntilDone] 

is the syntax for doing it.But both of them are instance methods of the same class.And the 1st threads return type is a void value and the 2nd threads return value is uint8_t. How to receive the signal from the 1st thread onto the second thread which has begun its execution just before the 1st 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-05-22T23:03:35+00:00Added an answer on May 22, 2026 at 11:03 pm

    The first thing about Cocoa is that all display code should run on the main thread. So if you are asking how to let the main thread know it needs to do some display work, performSelectorOnMainThread:waitUntilDone: is the right answer. This method works by putting an artificial “event” in the main thread’s run loop (the loop that processes events from the UI and timers etc). The receiver will invoke the method exactly as if you had called it directly but it will happen on the main thread.

    If you want to signal another thread that the display work has finished, you can do it synchronously like this:

    [receiver performSelectorOnMainThread: @selector(mySelector) withObject: nil waitUntilDone: YES];
    

    The calling thread will then pause until the method has finished.

    If you just want to fire and forget it’s

    [receiver performSelectorOnMainThread: @selector(mySelector) withObject: nil waitUntilDone: NO];
    

    The pattern is generalisable to any thread with the method performSelectorOnThread:withObject:waitUntilDone:. However, if you do this, you must make sure the target thread is executing a run loop.

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

Sidebar

Related Questions

It seems that most new programming languages that have appeared in the last 20
I have an interesting idea for a new programming language. It's based on a
Suppose I have designed a new programming language for one of the managed code
I'm looking to start a new programming language and for my first task I
I am from Unix programming background and am facing a unique behavior/problem during porting
I am new to programming, so to start with correct me if I am
I want to learn a new programming language. I have in mind stuff like
i been thinking of a new programming language. Before trying to implement it i
What features could be added to a new programming language to make it more
let's say that you in your new programming work your boss comes and says

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.