• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Coredata and threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Coredata and threads (From: Todd Freese <email@hidden>)

  • Prev by Date: Core Data Binding: Reading a binary image (TIFF)
  • Next by Date: Checkboxes in Table Views
  • Previous by thread: Coredata and threads
  • Next by thread: Re: Coredata and threads
  • Index(es):
    • Date
    • Thread