Re: Concurrent NSOperation
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