Skip navigation.
 
mlRe: CoreData multithreading question: @synchronized
FROM : Jim Correia
DATE : Wed Apr 04 19:45:30 2007

On Apr 4, 2007, at 1:28 PM, Ruotger Skupin wrote:

> a short CoreData question. according to the manual:
>
> Managed objects themselves are not thread safe. In order to work 
> with a managed object across different threads, you should lock its 
> context (see NSLocking).


The test you quoted from the documentation refers the the NSLocking 
protocol, which is wholly separate from @synchronize'd regions.

Furthermore, the same documentation says, quite explicitly:

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

   For locking, you should use the NSLocking methods on managed object 
context
   and persistent store coordinator instead of implementing your own 
mutexes.

Finally, you may wish to consult the list archives for previous 
advice that has been given about this topic. In particular:

   http://lists.apple.com/archives/cocoa-dev/2007/Mar/msg00739.html

Jim

Related mailsAuthorDate
mlCoreData multithreading question: @synchronized Ruotger Skupin Apr 4, 19:28
mlRe: CoreData multithreading question: @synchronized Shawn Erickson Apr 4, 19:42
mlRe: CoreData multithreading question: @synchronized Jim Correia Apr 4, 19:45