Re: Killing a stuck NSThread
Re: Killing a stuck NSThread
- Subject: Re: Killing a stuck NSThread
- From: Ivan Kourtev <email@hidden>
- Date: Wed, 26 Apr 2006 16:49:26 -0400
Why not set up a Distributed Objects connection to a proxy object in
the worker thread. Then you can just tell the proxy object to
terminate its thread.
http://developer.apple.com/documentation/Cocoa/Conceptual/
DistrObjects/index.html
--
ivan
On Apr 26, 2006, at 4:02 PM, Axel Andersson wrote:
On Apr 26, 2006, at 20:56, Dustin Wenz wrote:
I have an application that spawns an NSThread to perform a
blocking network operation. Sometimes the operation takes too long
to execute and needs to be cancelled or killed by the main thread.
Cancelling a thread is generally very hard to get right, and not
something commonly recommended. Consider communicating that the
other thread should exit via some status variable instead. As
you're working with blocking sockets, look into the mechanisms for
testing socket read/writes with a timeout, so that you can break
out of the network operation every once in a while and check your
status variable. Alternatively, use that timeout itself to
determine when the operation has taken too long.
http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/index.html
http://developer.apple.com/documentation/Darwin/Reference/ManPages/
man2/select.2.html
-- Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden