simple thread communication
simple thread communication
- Subject: simple thread communication
- From: Devon E Bowen <email@hidden>
- Date: Tue, 13 Apr 2004 09:37:12 -0400 (EDT)
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?
Devon
_______________________________________________
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.