Re: External kill of an NSThread?
Re: External kill of an NSThread?
- Subject: Re: External kill of an NSThread?
- From: AgentM <email@hidden>
- Date: Tue, 21 Nov 2006 15:40:19 -0500
On Nov 21, 2006, at 15:11 , Roland Torres wrote:
My code makes a call to a 3rd party library (not mine) that issues
an NSData dataWithContentsOfURL: call. It's this call that hangs
the show if it can't reach the URL specified. So I thought I might
invoke it in its own thread and kill it if it hangs. Is there a
better way, without mucking with the 3rd party library?
Since this is an unusual situation, you might carefully try
pthread_cancel(). read() is a valid cancel point.
http://lists.apple.com/archives/Darwin-dev/2006/May/msg00209.html
You should run your program under the various leak tools to determine
if canceling the thread results in memory leaks.
But, in any case, you should skip this thread stuff altogether, use
asynchronous communication to download the necessary data to a file
and then pass a file:// URL into the 3rd party library. Good luck!
-M
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins (at) lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden