Re: Coredata and threads
Re: Coredata and threads
- Subject: Re: Coredata and threads
- From: Chris Hanson <email@hidden>
- Date: Tue, 3 Jan 2006 17:48:48 -0800
On Jan 3, 2006, at 4:11 PM, Todd Freese wrote:
I have a Core Data Doc-style application in which I need to add
records from another thread using the
insertNewObjectForEntityForName method. Do I need to create another
ManagedObjectContext?
The recommended pattern when working with Core Data is to use (at
least) one managed object context per thread, and to avoid sharing
managed object contexts or managed objects between threads. (Sharing
managed objects is effectively the same thing as sharing managed
object contexts.)
Or can I use [self managedObjectContext]? The main thead has a
bound NSArrayController/NSTableView.
You cannot use the document's context, because bindings are not
thread-safe and you cannot make them so yourself.
No sure the best thread safe way to do this...
Is there any Core Data documentation regarding theading issues? I
seemed to have missed it.
There has been significant discussion of multithreading with Core
Data on the mailing list, and there is some documentation on the
topic as well. See the BackgroundFetching example in /Developer/
Examples/CoreData.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden