• 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: NSOperation and threadDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOperation and threadDictionary


  • Subject: Re: NSOperation and threadDictionary
  • From: Kyle Sluder <email@hidden>
  • Date: Wed, 22 Sep 2010 11:43:45 -0700

On Wed, Sep 22, 2010 at 11:31 AM, Rick Mann <email@hidden> 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 (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: NSOperation and threadDictionary
      • From: Rick Mann <email@hidden>
References: 
 >NSOperation and threadDictionary (From: Rick Mann <email@hidden>)
 >Re: NSOperation and threadDictionary (From: Julien Poissonnier <email@hidden>)
 >Re: NSOperation and threadDictionary (From: Rick Mann <email@hidden>)

  • Prev by Date: Question in regards to iTunes XML
  • Next by Date: Re: Question in regards to iTunes XML
  • Previous by thread: Re: NSOperation and threadDictionary
  • Next by thread: Re: NSOperation and threadDictionary
  • Index(es):
    • Date
    • Thread