[MacRuby-devel] Fibers and Enumerators

Scott Thompson easco at mac.com
Fri Aug 13 15:43:15 PDT 2010


On Aug 13, 2010, at 5:38 PM, Ernest N. Prabhakar, Ph.D. wrote:

> Hi Scott,
> 
> On Aug 13, 2010, at 1:46 PM, easco wrote:
>>> Remember, nobody is defending the POSIX pthread APIs here, they're saying that GCD makes Fibers less relevant...
>> 
>> GCD makes Fibers less relevant so long as you are willing to lock your code to the MacRuby platform. ;-)  But I think we've all agreed on that point as well.
> 
> Um, I'm not sure.  My understanding is that:
> 
> a) GCD makes it trivial to implement the *semantics* of Fibers, by using e.g., semaphores for suspend/resume
> 
> b) GCD does not make it trivial to implement the *syntax* of Fibers, but that should be possible with some (relatively minor) MacRuby hacking
> 
> Am I missing something?

What happens if a thread is executing a GCD block, and that block yields (blocks on the semaphore).  Will GCD release the blocked thread to handle other queues that are not blocked?

Scott



More information about the MacRuby-devel mailing list