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

Re: Concurrent NSOperation


  • Subject: Re: Concurrent NSOperation
  • From: Chris Kane <email@hidden>
  • Date: Sat, 24 Nov 2007 14:14:39 -0800

"preparing the runtime environment" is fairly vague because there are many different situations that might crop up for operation usage. In this particular case, it sounds like "preparing the runtime environment" could be interpreted to mean "add the operation as an observer of the notification to the notification center". And - isConcurrent can be overridden to return YES. If nothing (like your - start method) is going to refer to -main, you need not implement one in the subclass.

In your notification handler method, you should make sure to maintain KVO compliance, either by manually invoking the will/didChange methods, or by creating a "finished" state in your subclass, and implementing -setIsFinished: to return that state, a -setIsFinished: to set that state, and invoking setIsFinished: from the notification handler. You'll want to override +automaticallyNotifiesObserversForKey: to return the correct answer (NO or YES respectively) for the @"isFinished" key.

Or something along those lines.

Chris Kane
Cocoa Frameworks, Apple


On Nov 21, 2007, at 9:40 AM, Keith Duncan wrote:

I'm writing an NSOperation subclass which completes it's work asynchronously. As such I'm going to have to write a concurrent operation.

The problem I have is that I don't want to have to setup my own 'runtime environment', quoted from the docs:

"In your start method, you must prepare the operation for execution, which includes preparing the runtime environment for your operation. (For example, if you wanted to create a thread yourself, you would do it here.) Once your runtime environment is established, you can call any methods or functions you want to subsequently start your operation. Your implementation of the start method should not invoke super."

I simply need to mark the operation as complete when it receives an NSNotification. I could setup a thread but that seems a little pointless since that NSOperation is supposed to handle it automatically.

- Keith

_______________________________________________

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

_______________________________________________

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


References: 
 >Concurrent NSOperation (From: Keith Duncan <email@hidden>)

  • Prev by Date: Outline View drawing changes in Leopard?
  • Next by Date: Re: Capturing NSLog in Leopard
  • Previous by thread: Re: Concurrent NSOperation
  • Next by thread: NSDate appears to leak
  • Index(es):
    • Date
    • Thread