• 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 thread safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser thread safe?


  • Subject: Re: NSXMLParser thread safe?
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 01 Jun 2012 18:15:09 -0700

On Jun 1, 2012, at 4:18 PM, Graham Cox <email@hidden> wrote:

>
> On 02/06/2012, at 1:55 AM, Nick Zitzmann wrote:
>
>> That depends. How are you creating the thread? It isn't difficult to do using either the pthread or NSThread APIs.
>
>
> Well, I started with the NSThread method that I've used classically, but moved it over to using NSInvocationOperations in a NSOperationQueue. This second approach is easier, and more stable, but I found a few places where things were going pear shaped, mostly to do with accessing shared caches, which was easily dealt with using @synchronised blocks.

It's important to note that operation queues (and dispatch queues for that matter) do not guarantee anything about what threads your operations execute on. Apple's notoriously slippery definition of "thread-safe" can still bite you if the implication is that an NSXMLParser instance is safe to use from a non-main thread as long as *all* uses are from the *same* thread. That would make it unsafe to access the same NSXMLParser instance from two different NSOperations.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: NSXMLParser thread safe?
      • From: Graham Cox <email@hidden>
    • Re: NSXMLParser thread safe?
      • From: Joar Wingfors <email@hidden>
References: 
 >Re: NSXMLParser thread safe? (From: Nick Zitzmann <email@hidden>)
 >Re: NSXMLParser thread safe? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSXMLParser thread safe?
  • Next by Date: Re: NSXMLParser thread safe?
  • Previous by thread: Re: NSXMLParser thread safe?
  • Next by thread: Re: NSXMLParser thread safe?
  • Index(es):
    • Date
    • Thread