From: "headius (Charles Nutter)" Date: 2012-10-23T00:55:57+09:00 Subject: [ruby-core:48151] [ruby-trunk - Bug #7087] ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist Issue #7087 has been updated by headius (Charles Nutter). A few JRuby tidbits that might help shed some light. Java's per-object monitors are reentrant, as already stated. They do not, however, provide a mechanism for querying who has locked, how many are waiting, etc. Because of that, JRuby implements Mutex using ReentrantLock and just ensures the same thread cannot lock the same Mutex twice: https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/thread/Mutex.java The standard 'thread' library ConditionVariable is implemented atop Mutex, as in Ruby: https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/thread/ConditionVariable.java And we use the same monitor.rb as 1.9.3. ---------------------------------------- Bug #7087: ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist https://bugs.ruby-lang.org/issues/7087#change-31226 Author: rklemme (Robert Klemme) Status: Open Priority: Low Assignee: matz (Yukihiro Matsumoto) Category: lib Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [i686-linux] See program attached to bug #7086: timeout_4 always throws: ERROR: method "timeout_4": #> $ irb19 -r monitor irb(main):001:0> Monitor.new.method(:sleep) => # irb(main):002:0> Monitor.instance_methods.grep /sleep/ => [] -- http://bugs.ruby-lang.org/