On Nov 21, 2010, at 11:47, vincent habchi wrote:

> briefly speaking, I have a Core Data Entity bearing a to-many relationship 
> (therefore an NSSet * iVar).

It's not an ivar, it's a property.

> A dialog on the main thread can modify this set,

You can't modify a NSSet. I suspect you mean "modify this relationship", but 
the ambiguity leads me to wonder if you're trying to do something funky here. 
Not that it's relevant to your actual question ...

> while it may be simultaneously enumerated on a background GCD thread. I have 
> therefore used the managed object context provided mutex to protect the 
> respective snippets.
> 
> I am improving the background thread, replacing the enumeration by a fetch 
> operation. Do I still need the lock, or is it provided internally by the Core 
> Data framework?

Look at:

        
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html

under the heading "General Guidelines". If I understand your scenario 
correctly, you've been using approach #3, the one labeled "This approach is 
strongly discouraged".

Use approach #1 (except in the unlikely case that performance is an issue 
without full concurrency, in which case use approach #2).


_______________________________________________

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

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

Reply via email to