On Sun, Feb 22, 2009 at 3:46 PM, Luke Evans <l...@eversosoft.com> wrote:
> My discovery (and life is full of them, so nothing particularly unusual
> here) is that the practicality of doing the locking appears to 'tip over' if
> you have binding to your Core Data.  I have my main thread, and one
> background thread trawling for files - both scrupulously locked on the MOC
> around _any_ access, i.e. even reading a property.

No you don't. You're locking around any *explicit* access to a
property. Meanwhile your implicit accesses due to bindings are going
unlocked, and your code fails, hard.

It's a basic tenet of multithreading. If you're taking an unsafe
datastructure, and making it safe by synchronizing all accesses with
locks, you *cannot* give *any* references to that data structure to
outside code.

Bindings will not follow your locking protocol, so you can't let them
touch your context with this approach.

Mike
_______________________________________________

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