• 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: Core Data threading fun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data threading fun


  • Subject: Re: Core Data threading fun
  • From: Luke Evans <email@hidden>
  • Date: Mon, 21 Sep 2009 11:43:03 -0700

Hi Kyle,

Actually that's exactly what the doctor ordered (I think).
I had missed this facet of using Core Data in across multiple threads.

So, thank you very much.  I'm sure you have saved me a lot of time.

One last question comes to mind:
As the NSManagedObjectContextDidSaveNotification will be posted on the main thread, is it safe to do a - mergeChangesFromContextDidSaveNotification: on the main thread for any given MOC?
My guess is no - unless the MOC has internal synchronisation for all its work that this method also makes use of, then there's nothing to stop the owning thread from updating the MOC while it's being updated in this way.
The obvious way to deal with that would be to perform the "mergeChanges" on the owning thread, but that will require an appropriate runloop on each thread.


-- Luke

On 2009-09-21, at 1:31 AM, Kyle Sluder wrote:

Have you remembered to merge changes whenever a thread's MOC posts
NSManagedObjectContextDidSaveNotification?  If the objects which are
seeing the stale properties haven't been faulted out or hit their
staleness interval, you will see this behavior.

Take a look at the NSManagedObject methods
-mergeChangesFromContextDidSaveNotification: and
-refreshObject:mergeChanges: for more info.

--Kyle Sluder


_______________________________________________

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


  • Follow-Ups:
    • Re: Core Data threading fun
      • From: Kyle Sluder <email@hidden>
References: 
 >Core Data threading fun (From: Luke Evans <email@hidden>)
 >Re: Core Data threading fun (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Printing to NSData
  • Next by Date: Re: Optimizing Enormous lists in NSBrowser
  • Previous by thread: Re: Core Data threading fun
  • Next by thread: Re: Core Data threading fun
  • Index(es):
    • Date
    • Thread