Hi Shri,
While it is true that Thread.critical= cannot be realized if multiple threads run in parallel,
this is not the case for the current MRI. At least, when I last looked, even Ruby 1.9 was
running "Native Thread with Giant VM lock". If this is still the case, the attached patch
will implement the Thread.critical= method. Please note, however, that this patch was
last tested about one year ago. It should be used as a guide. Hope it helps, or at least
gives you some ideas.
- brent
ruby19_thcritical.patch
Shri Borde wrote:
Hi,
Thread.critical= is supposed to not schedule any other thread, in addition to guaranteeing that only one thread is ever in the block with Thread.critical==true. This is easier to support with green threads.
With native threads, it is harder to do. I am working on IronRuby, and have some questions:
...