Re: receptionist pattern question: NSOperationQueue vs. GCD
Re: receptionist pattern question: NSOperationQueue vs. GCD
- Subject: Re: receptionist pattern question: NSOperationQueue vs. GCD
- From: Seth Willits <email@hidden>
- Date: Wed, 15 Feb 2012 12:42:19 -0800
On Feb 15, 2012, at 11:19 AM, Matt Neuburg wrote:
> My question is simply this: in a world that has GCD, is there any reason why we wouldn't have "queue" be a GCD dispatch queue (probably the main queue) and call dispatch_asynch?
I don't believe there's any difference in this example.
> Putting it even more generally (and this is probably my *real* question), is there any reason why I'd ever use NSOperationQueue's addOperationWithBlock given the existence of GCD?
NSOperationQueue has support for dependencies between operations (which I take advantage of). You can also set max concurrency which can be useful. With some tweaks you can make NSOperationQueue serial, which when combined with inter-queue dependencies is useful.
This can all be done with GCD (NSOpQ is implemented with GCD after all), but with GCD it's more work and I'm more likely to make mistakes than with NSOpQ, so it's still useful in my experience.
--
Seth Willits
_______________________________________________
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