Hi John,

On Nov 23, 2009, at 12:55 PM, John Shea wrote:
No I assume at some stage the ruby block has to be turned into a C block with associated scope - and from my limited knowledge on GCD that does not seem so easy. 

Again, I think I'm still missing your point. In the context of GCD, this is a non-issue since you don't *have* to use C blocks.  Instead, GCD provides a function pointer + context pointer API, which is what MacRuby uses:

http://github.com/masterkain/macruby/blob/master/gcd.c

    if (RTEST(synchronous)){
        dispatch_sync_f(RQueue(self)->queue, (void *)block,
rb_queue_dispatcher);
    }
    else {
        dispatch_async_f(RQueue(self)->queue, (void *)block,
rb_queue_dispatcher);
    }

That is, C just treats the Ruby block as a data pointer.

-- Ernie P.