On Jun 1, 2012, at 4:18 PM, Graham Cox <graham....@bigpond.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to