Hi,

Thread.critical=3D is supposed to not schedule any other thread, in additio=
n to guaranteeing that only one thread is ever in the block with Thread.cri=
tical=3D=3Dtrue. 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:

1. Should it be by spec that other threads are not allowed to be scheduled?=
 Thread#inspect for the other threads actually says "run", not "sleep".

2. How would you test that the other threads are not scheduled. It can be d=
one by having the other threads increment some class variable, and by check=
ing that its value does not change. So this is mostly a rhetorical question=
.

3. Given that implementations with native threads cannot support this perfe=
ctly, how many apps would actually be affected? The few gems I have looked =
at only need that Thread.critical=3Dtrue only behave like a critical sectio=
n. The apps will work even if the other threads are scheduled, as long the =
other threads block when they themselves try to set Thread.critical=3Dtrue.=
 According to http://www.megasolutions.net/ruby/basic-threading-question_ca=
n-ruby-use-real-threads_-64225.aspx, JRuby supports this by having every th=
read periodically do a checkpoint to see if it should suspend itself. It se=
ems that most apps would continue working if there was only one checkpoint,=
in Thread.critical=3D.

Thanks,
Shri