From: "kosaki (Motohiro KOSAKI)" Date: 2012-12-16T02:56:48+09:00 Subject: [ruby-core:50918] [ruby-trunk - Feature #7087] ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist Issue #7087 has been updated by kosaki (Motohiro KOSAKI). Following patch fix this issue, I think. diff --git a/lib/monitor.rb b/lib/monitor.rb index 07394b5..30701c7 100644 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -215,6 +215,10 @@ module MonitorMixin end alias synchronize mon_synchronize + def sleep(timeout = nil) + @mon_mutex.sleep timeout + end + # # Creates a new MonitorMixin::ConditionVariable associated with the # receiver. ---------------------------------------- Feature #7087: ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist https://bugs.ruby-lang.org/issues/7087#change-34771 Author: rklemme (Robert Klemme) Status: Assigned Priority: Low Assignee: matz (Yukihiro Matsumoto) Category: lib Target version: next minor 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/