From: Eric Jacoboni Date: 2008-02-20T22:09:59+09:00 Subject: Ruby 1.9, threads and FreeBSD 5 Hi, Considering the following theory code: require "thread" ping = ConditionVariable.new pong = ConditionVariable.new mutex = Mutex.new 1.upto(10) do # 10 threads pong Thread.new do mutex.synchronize do ping.wait(mutex) puts("Pong...") pong.signal end end end 1.upto(10) do # 10 threads ping Thread.new do mutex.synchronize do pong.wait(mutex) puts("Ping...") ping.signal end end end pong.signal # Go! Thread.list.each { |t| t.join if t != Thread.main } This code works as expected with Ruby 1.8 on FreeBSD and OS X : % /usr/bin/ruby ping_pong_cond.rb Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... Ping...Pong... But it blocks with Ruby 1.9 on both OS : % ruby ping_pong_cond.rb ^Cping_pong_cond.rb:30:in `join': Interrupt from ping_pong_cond.rb:30:in `block in
' from ping_pong_cond.rb:30:in `each' from ping_pong_cond.rb:30:in `
' Furthermore, it works fine with Ruby 1.9 on Vista. As i know there is some change in Ruby threads/Native threads between 1.8 and 1.9, i suspect this change could be the culprit... Any clue? Thanks