From: "rklemme (Robert Klemme)" Date: 2012-09-30T01:32:45+09:00 Subject: [ruby-core:47740] [ruby-trunk - Bug #7087] ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist Issue #7087 has been updated by rklemme (Robert Klemme). kosaki (Motohiro KOSAKI) wrote: > At least, this is intentional. condtion variable and monitor have different inspiration source. > condition variable is based on POSIX CV and monitor is based on Java monitor semantics. To be > honest, I'm not familiar Java's conditon variable. For me the difference between Mutex and Monitor is only reentrancy. Other than that I'd have expected them to be identical (usage and interface). > Could you please explain the detail of your > suggestion? Which semantics do you hope? I would have expected that I can use a Monitor / instance which includes MonitorMixin the same way as a Mutex with ::ConditionVariable. If that is not intended then I'd rather have an exception TypeError from ::ConditionVariable#wait indicating that a Mutex must be used than the exception about the private sleep method (which happens to be the one from Kernel). ---------------------------------------- Bug #7087: ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist https://bugs.ruby-lang.org/issues/7087#change-29794 Author: rklemme (Robert Klemme) Status: Open Priority: Low Assignee: Category: 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/