• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: External kill of an NSThread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >External kill of an NSThread? (From: Roland Torres <email@hidden>)
 >Re: External kill of an NSThread? (From: John Stiles <email@hidden>)
 >Re: External kill of an NSThread? (From: Filipe Varela <email@hidden>)
 >Re: External kill of an NSThread? (From: Roland Torres <email@hidden>)

  • Prev by Date: Re: External kill of an NSThread?
  • Next by Date: Re: NSTableView and NSView
  • Previous by thread: Re: External kill of an NSThread?
  • Next by thread: Re: External kill of an NSThread?
  • Index(es):
    • Date
    • Thread