Hi again, 

thanks for the code ..

I am actually not trying to make a point - just trying to learn, and start a discussion that leads to learning.

since the code below means nothing to me - thats probably a good place for me to start.

Cheers,
J

On Nov 23, 2009, at 9:58 PM, Ernest N. Prabhakar, Ph.D. wrote:

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:


    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.


_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel