• 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: Handling NSManagedObjectContextDidSaveNotification from different threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling NSManagedObjectContextDidSaveNotification from different threads


  • Subject: Re: Handling NSManagedObjectContextDidSaveNotification from different threads
  • From: Keary Suska <email@hidden>
  • Date: Wed, 11 Aug 2010 13:55:26 -0600

On Aug 10, 2010, at 2:55 PM, Rick Mann wrote:

> We have an app that uses a "main" NSManagedObjectContext (MOC) for all UI-related work, and has background threads that add and update data via their own dedicated MOCs. When they call -save: on their MOC, the "main" MOC gets the NSManagedObjectContextDidSaveNotification and calls -mergeChangesFromContextDidSaveNotification:.
>
> The problem is, this actually happens on the thread that called -save:, not on the main thread. We're seeing occasional crashes, and suspect that it is due to this problem. However, I didn't see anything in the docs that said we had to call -save: from the main thread, or take any special steps when handling that notification.
>
> Did I just overlook something, or should this work safely always? It seems like the latter is unlikely, since two threads could be accessing a MOC simultaneously.

Are you following or taking into account everything shown here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#//apple_ref/doc/uid/TP40003385-SW1 ?

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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: Handling NSManagedObjectContextDidSaveNotification from different threads
      • From: Rick Mann <email@hidden>
References: 
 >Handling NSManagedObjectContextDidSaveNotification from different threads (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Disable return-edit in text cell
  • Next by Date: Re: Handling NSManagedObjectContextDidSaveNotification from different threads
  • Previous by thread: Handling NSManagedObjectContextDidSaveNotification from different threads
  • Next by thread: Re: Handling NSManagedObjectContextDidSaveNotification from different threads
  • Index(es):
    • Date
    • Thread