Re: Difference between @synchronized and [managedObjectContext lock]?
Re: Difference between @synchronized and [managedObjectContext lock]?
- Subject: Re: Difference between @synchronized and [managedObjectContext lock]?
- From: Laurent Daudelin <email@hidden>
- Date: Tue, 29 Nov 2011 13:56:22 -0800
Thanks, Dave, I had missed that part!
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
Logiciels Nemesys Software email@hidden
On Nov 29, 2011, at 13:34, Dave Fernandes wrote:
> See (bottom of page):
> http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/coredata/Articles/cdConcurrency.html#//apple_ref/doc/uid/TP40003385-SW1
>
> "If you share a managed object context or a persistent store coordinator between threads, you must ensure that any method invocations are made from a thread-safe scope. For locking, you should use the NSLocking methods on managed object context and persistent store coordinator instead of implementing your own mutexes. These methods help provide contextual information to the framework about the application's intent—that is, in addition to providing a mutex, they help scope clusters of operations."
>
>
> On 2011-11-29, at 3:08 PM, Laurent Daudelin wrote:
>
>> I'm working on some code that I didn't write and have some core data areas that use [managedObjectContext lock] and [managedObjectContext unlock] while other areas in the code uses @synchronized. I know that @synchronized is a convenience to create a mutex lock so that not 2 threads can acquire the same lock at the same time but are there other differences? Is one better than the other?
>>
>> Thanks for any insight on this!
>>
>> -Laurent.
>> --
>> Laurent Daudelin
>> AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
>> Logiciels Nemesys Software email@hidden
>>
>> _______________________________________________
>>
>> 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
>
_______________________________________________
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