• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: simple thread communication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple thread communication


  • Subject: Re: simple thread communication
  • From: Nicko van Someren <email@hidden>
  • Date: Tue, 13 Apr 2004 15:02:28 +0100

On 13 Apr 2004, at 14:37, Devon E Bowen wrote:

I need to call gethostbyname() but I don't want my program to block
if DNS is not available. So I spin off a separate thread to call
gethostbyname() and set a variable with the answer. This happens
while the main thread goes back to its run loop so there is no
blocking at all. Very simple.

But I need a way of informing the main thread that the subthread
is finished.

Have you looked at the NSObject method performSelectorOnMainThread:withObject:waitUntilDone: ? I think this will do what you need.

Nicko
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >simple thread communication (From: Devon E Bowen <email@hidden>)

  • Prev by Date: Re: simple thread communication
  • Next by Date: RE: Rendezvous and synchonization
  • Previous by thread: Re: simple thread communication
  • Next by thread: textFieldEditor in NSBrowser
  • Index(es):
    • Date
    • Thread