Re: simple thread communication
Re: simple thread communication
- Subject: Re: simple thread communication
- From: Kevin Ballard <email@hidden>
- Date: Tue, 13 Apr 2004 09:55:46 -0400
look up -performSelectorOnMainThread:withObject:waitUntilDone:
(NSObject)
On Apr 13, 2004, at 9:37 AM, 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. Really all I want is to schedule a method call in the
>
main thread from the subthread. Like I might normally do with
>
performSelector:withObject:afterDelay:. But I can't find anything
>
in the thread docs that say this is possible. The only thing they
>
talk about is setting up distributed objects with NSConnection
>
and friends. But that seems like way to much complication for this
>
tiny example.
>
>
Am I missing something? Is there a simply way for one thread to
>
kick another?
--
Kevin Ballard
email@hidden
http://www.tildesoft.com
http://kevin.sb.org
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.