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

Re: async NSOperation and NSOperationQueue


  • Subject: Re: async NSOperation and NSOperationQueue
  • From: John Love <email@hidden>
  • Date: Tue, 16 Sep 2008 10:12:57 -0400

Couple of things... you don't wanna create a queue every time. You should
pretty much have just one queue that you add NSOperation objects to. You
probably want to re-write this to be a singleton object that you get from your
app controller or some other relevant place.

Queue initialization now done via my appController's -init and released via -dealloc.


Also, you most definitely do not want to autorelease your queue. It will end
up going away on you when you least want it to or expect it to. Create your
queue somewhere (hopefully in your app controller or somewhere like that)
and then release it when you're absolutely sure that all your operations have
run and you don't want to ever add any more.

[ ... autorelease] gone with the queue explicitly released via appController's -dealloc.



You /should/, however, autorelease your NSOperation since your queue will retain it when you add it and release it when it completes.

Not done yet ... are saying that as soon as my Operation is complete, or the @selector method has finished, the Operation is automatically released?


In spite of all the good news, my app still "appears" to be held captive by the queue and its added operations. I say "appears" deliberately because it may be due to other causes.

Specifically, for example, while the queue is doing its calculation, I cannot press CMD-N to create a new document window. To continue with this specific example, CMD-N does do its thing, but only after the queue operation's calculations are finished. Ditto for CMD-Q or quitting.

Let's name the controller doing these calculations CalcController which is a connected IB Outlet for another controller called OutsideController. OutsideController calls [iboCalcController startCalculation] The method/routine within OutsideController does *not* continue to its next instruction until iboCalcController's startCalculation finishes.

I've begun to get a little smart on NSNotificationCenter and incorporating one of these objects within OutsideController -- but I am definitely not even remotely sure if this is the way to go.


John Love Touch the Future! Teach!

_______________________________________________

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: async NSOperation and NSOperationQueue
      • From: John Love <email@hidden>
    • Re: async NSOperation and NSOperationQueue
      • From: "Michael Ash" <email@hidden>
References: 
 >Re: async NSOperation and NSOperationQueue (From: John Love <email@hidden>)
 >Re: async NSOperation and NSOperationQueue (From: Jason Coco <email@hidden>)

  • Prev by Date: How do I check if at least one TWAIN device is available
  • Next by Date: Re: structs in Mutable containers
  • Previous by thread: Re: async NSOperation and NSOperationQueue
  • Next by thread: Re: async NSOperation and NSOperationQueue
  • Index(es):
    • Date
    • Thread