On Oct 3, 2013, at 12:17 PM, Kyle Sluder <[email protected]> wrote:
> What is adopting GCD going to get you if you aren't going to use GCD the
> way it was intended?
Could you be a bit friendlier here and cut me some slack? Of course I want to
use GCD in the way it’s intended. I’m an experienced developer, I’ve been
writing concurrent code for 15 years, I use GCD-type constructs all the time in
Go. I have read the GCD documentation and I think I have a good handle on its
principles.
I want to be able to use GCD without breaking all of the non-GCD code in my
project, until such time as I can replace all that code.
Also, my project is a library, and I don’t want to put too many restrictions on
how it’s used by the caller. For example, here’s one method that runs an async
query:
- (void) runAsync: (void (^)(CBLQueryEnumerator*))onComplete;
When the query results are available, the onComplete block is called. The
problem is, in what context should the block be called? Currently it’s
scheduled on the same runloop as the original call. That works great for
runloop-based clients. But if this method is called from a dispatch queue
(except the main one) it won’t work. Do I have to have a second variant, like
runAsync:onQueue:, that does the same thing except it invokes the block on a
queue? That’s messy, and if runloops had queues it would be unnecessary.
Does anyone have any comments beyond “this isn’t supported, it's bad and you
are clueless”?*
—Jens (in an increasingly grumpy mood today)
* http://www.offworlddesigns.com/rules-lawyer-t-shirt/
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]