Re: External kill of an NSThread?
Re: External kill of an NSThread?
- Subject: Re: External kill of an NSThread?
- From: John Stiles <email@hidden>
- Date: Tue, 21 Nov 2006 13:49:26 -0800
Canceling a thread in this way is very likely to leave the entire
NSURL system in disarray.
I think another poster summed it up best—download the data yourself
in a safe way, and then pass a file:// URL to this library. That will
be simpler code and much much more robust.
Another valid option would be to invoke this code in a thread, and
don't kill the thread if it hangs. If it hangs, let it stay hung.
It's in a separate blocked thread—it's not taking any CPU time and
theoretically isn't doing anything user-visible. When the thread
comes back to life, whenever that might be, end the thread in the
normal way. If it never unblocks, just shrug it off.
On Nov 21, 2006, at 12:11 PM, 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?
Roland
On Nov 21, 2006, at 9:14 AM, Filipe Varela wrote:
Howdy
Wouldn't it be better to handle the error that's causing the hang
from within the offending thread? What's the point of
encapsulation if objects keep manipulating each other?
Cheers,
Filipe
How does one kill an NSThread from another thread? As I read the
documentation, it seems possible only from within the thread, by
calling MPExit(). If I have a thread that hangs, I'd like to
kill it from another thread, but I don't see an API to do this.
NSThread doesn't return a thread id or descriptor, so how does
one manage them?
Roland
_______________________________________________
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:
40blizzard.com
This email sent to email@hidden
_______________________________________________
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