On Wed, Sep 22, 2010 at 11:31 AM, Rick Mann <rm...@latencyzero.com> wrote: > Pity. We have a singleton object that creates a subclass of NSOperation, > which then calls back a method on the singleton that's intended to be run on > a separate thread (provided indirectly by the NSOperation). That singleton > needs it's own NSManagedObjectContext, which we were creating and then > passing around to everything the singleton called. We wanted to avoid the > danger of creating additional ones by storing it in TLS, but I guess we're > not supposed to do that (although it does talk about data that you "create > yourself or manage," which is the case here).
You wanted to avoid the danger of creating additional NSManagedObjectContexts? As far as I understand your design, you need to create a new MOC for every NSOperation instance, regardless of what thread it winds up being executed on. Theoretically, you'll never even spawn another thread; you might be running on a Core Solo, and GCD and/or NSOperationQueue might just run everything on the main thread. (I don't know if that's actually possible; GCD operations might always run on a background thread, but I can certainly foresee the system deciding not to create more than one background thread on a single-core Mac.) --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com