• 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: Roland Torres <email@hidden>
  • Date: Tue, 21 Nov 2006 15:46:31 -0800

On Nov 21, 2006, at 3:16 PM, Murat Konar wrote:

On Nov 21, 2006, at 2:13 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?

Check the URL for reachability before attempting to reach it? Search the archives for "SCNetworkCheckReachabilityByName".

I did. SCNetworkConnectionFlags() tells me only that the IP portion of the URL is valid; it doesn't verify that the URL itself is valid.

Apologies. Your description of the problem was that the library hangs when it can't reach the URL. That's a pretty easy situation to work around but is evidently not actually the situation causing you grief.


How exactly is your problematic URL invalid?

Is there some method or function I could use for this purpose?

Depends on what is wrong. There are many ways a URL can be "invalid". It might not conform to the URL spec, the host specified in the URL might not exist or be reachable, the resource pointed to by the URL might not exist, etc.

By "invalid" I just mean that the URL doesn't exist or is inaccessible. If I could validate the URL before calling the 3rd party library, then I would be able to avoid the whole thing hanging. Sadly, Cocoa objects that use -initWithContentsOfURL: just hang forever on URLs they can't access, whereas Safari, Firefox, curl, etc., do manage to time out. So I guess I'm looking for some kind of "isThisURLAccessible(url)" call, or a "getContentsOfURL(url)" call that doesn't hang forever. I've looked into the CFNetwork programming guide, but it's really involved, and they don't give working examples or explain why they're doing what they do.


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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: External kill of an NSThread?
      • From: Murat Konar <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>)
 >Re: External kill of an NSThread? (From: Murat Konar <email@hidden>)
 >Re: External kill of an NSThread? (From: Roland Torres <email@hidden>)
 >Re: External kill of an NSThread? (From: Murat Konar <email@hidden>)

  • Prev by Date: Re: NSStatus item from background / command line application
  • Next by Date: Re: Re: Yielding an NSThread-started thread
  • Previous by thread: Re: External kill of an NSThread?
  • Next by thread: Re: External kill of an NSThread?
  • Index(es):
    • Date
    • Thread