Re: NSXMLParser thread safe?
Re: NSXMLParser thread safe?
- Subject: Re: NSXMLParser thread safe?
- From: Graham Cox <email@hidden>
- Date: Sat, 02 Jun 2012 09:18:24 +1000
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.
I'm still getting the occasional crash if I let the operation queue perform more than one operation at a time (i.e. it has a limit of 1, but runs it on a thread other than main, and that's OK, but for 2 or more, it sometimes falls over).
I think this has convinced me that there's something not quite thread-safe in my own code, rather than a stack space issue. While SVG parsing can sometimes end up with quite a deep stack, it's not failing specifically under those conditions.
I'll keep working on it....
--Graham
_______________________________________________
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