From: Shri Borde Date: 2009-01-15T16:46:29+09:00 Subject: [ruby-core:21361] Re: Supporting Thread.critical=with native threads Brent, we are looking for Ruby to officially allow Thread.critical= to be implemented as a single non-reentrant mutex. This would help convince people writing Ruby libraries in the future to use Thread.critical= without assuming that other threads will be descheduled. Otherwise, they can push back on JRuby and IronRuby as not being fully-compatible. The proposed spec I wrote up would clean things up even more. For example, you said "Thread.critical=false exits the critical section, regardless of how many times it had been been redundantly set true." However, consider the case where thread A sets Thread.critical=true, and then thread B does Thread.critical=false. (Note that even MRI will schedule other threads under certain circumstances like a newly created thread or if thread A does Kernel#sleep). In this case, you cannot force thread A to release the mutex. Your wording could possibly still be supported, for example, by having thread B create a new mutex and publish that as the single non-reentrant mutex to be used henceforth. I think such clean up would be good without causing too much incompatilibiles. However, we don't have to do all of these changes if compatability is a significant concern. As long as descheduling of other threads was not a requirement, that would go a long way. Regards, Shri