• 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: Hsu <email@hidden>
  • Date: Wed, 21 Nov 2007 16:07:34 -0800

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

That's not the way it works. For NSOperations, "concurrent" means "I'll provide the thread", not "synchronous". From the NSOperation docs:


"In the context of an NSOperation object, the terms concurrent and non- concurrent do not necessarily refer to the side-by-side execution of threads. Instead, a non-concurrent operation is one that executes using the environment that is provided for it while a concurrent operation is responsible for setting up its own execution environment."

followed by

"For a non-concurrent operation, an operation queue automatically creates a thread and calls the operation object’s start method..."


So, basically, for simple asychronous behavior just subclass NSOperation and override -main. NSOperationQueue will be responsible for creating the threading "environment", within the parameters set (e.g. -setMaxConcurrentOperationCount:).



Karl




--

If Goddess had intended humans to smoke, She would have set them on fire.

Homepage:
     http://homepage.mac.com/khsu/index.html

_______________________________________________

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: Concurrent NSOperation
      • From: Keith Duncan <email@hidden>
References: 
 >Concurrent NSOperation (From: Keith Duncan <email@hidden>)

  • Prev by Date: Re: NSStream or when NSStreamEventEndEncountered appears too late
  • Next by Date: XCode 3 Debugger bug?
  • Previous by thread: Re: Concurrent NSOperation
  • Next by thread: Re: Concurrent NSOperation
  • Index(es):
    • Date
    • Thread