Re: External kill of an NSThread?
Re: External kill of an NSThread?
- Subject: Re: External kill of an NSThread?
- From: "Adam R. Maxwell" <email@hidden>
- Date: Tue, 21 Nov 2006 20:25:49 -0800
On Nov 21, 2006, at 19:38, Roland Torres wrote:
On Nov 21, 2006, at 6:46 PM, John Stiles wrote:
If he's already willing to spin off a thread to do the work, all he
needs to do is wait for the thread to complete.
Why kill the thread early? Just let it take however long it needs,
and if the user gets tired of waiting, let them cancel and then
sweep up after the thread whenever dataWithContentsOfURL:url returns.
Yes, this makes a lot of sense, especially since it *is* going to
timeout eventually. I'll just "abandon" the thread (from the user
point of view). When it does complete, I call MPExit() from within
the thread, and it's all good.
Why are you calling MPExit() from an NSThread? You'd likely want to
use [NSThread exit], but even that shouldn't generally be necessary.
Also, ISTR having problems using +[NSData dataWithContentsOfURL:] in a
thread to load a file from a web server; it's not clear to me if the
underlying mechanism it uses is thread safe.
Adam
_______________________________________________
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