On Wed, Jun 21, 2006 at 01:39:53AM +0900, Patrick Hurley wrote:
> That is not true, it is completely possible to use an OS level
> mutex/critical section etc, from inside a "green" Ruby thread. It will
> block all Ruby threads which is not very nice, but I do not know of a
> better solution.

TRAP_BEG and TRAP_END work well for allowing Ruby to switch threads,
though the call between them must be interruptible.  I believe this
should be true of sem_wait(), though I've been unsuccessful interrupting
it on linux.

I typically use a pipe for this kind of synchronization.

Paul