• 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: NSXMLParser in background thread crashing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser in background thread crashing


  • Subject: Re: NSXMLParser in background thread crashing
  • From: Jim Correia <email@hidden>
  • Date: Fri, 23 Feb 2007 08:54:05 -0500

On Feb 23, 2007, at 12:16 AM, Philip Q wrote:

This isn't what thread safety means -- a thread safe class can be used
from multiple threads without using locks. Large parts of
Foundation/AppKit aren't thread safe, but are safe for using within a
single thread.

Thread safety isn't a black and white, binary issue.

There are multiple possibilities.

- Instances of this class can be used in multiple threads without using locks.

- Instances of this class can be used in multiple threads with appropriate locking.

- The documentation does say whether the class is thread-safe.

In the latter case, you can't assume that it is or isn't. It may rely on other classes or libraries which aren't thread safe. It may have shared resources which it doesn't access in a thread safe way. No amount of locking is going to solve this problem, because the frameworks themselves could also use this class at any time.

There shouldn't be any problem with using an NSXMLParser in a separate
thread.

Without specific documentation that it is thread safe, you can't assume this is true.


For example, was the underlying library compiled with the threading option turned on? Does NSXMLParser initialize the library correctly in the multi-threaded case?

Since it isn't documented as being thread safe, you have to assume the worse. Multi-threading bugs are delicate and testing isn't enough to ferret them out.

Jim



_______________________________________________

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: 
 >NSXMLParser in background thread crashing (From: "Justin R. Miller" <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: Jim Correia <email@hidden>)
 >Re: NSXMLParser in background thread crashing (From: "Philip Q" <email@hidden>)

  • Prev by Date: Re: NSXMLParser in background thread crashing
  • Next by Date: Re: NSXMLParser in background thread crashing
  • Previous by thread: Re: NSXMLParser in background thread crashing
  • Next by thread: Transforming NSBezierPaths using NSView
  • Index(es):
    • Date
    • Thread