From: Tanaka Akira Date: 2008-07-16T20:43:16+09:00 Subject: [ruby-dev:35542] [Bug:1.9] sleep and Thread#run 1.9 では sleep で寝ているスレッドを Thread#run で起こせない ようです。 % ./ruby -ve ' t = Thread.new { t1 = Time.now sleep 5 t2 = Time.now p t2 - t1 } sleep 1 t.run t.join ' ruby 1.9.0 (2008-07-16 revision 18083) [i686-linux] 5.139447392 sleep を Thread#run で起こせるっぽいことは rdoc に書いてありま す。 * Suspends the current thread for _duration_ seconds (which may be any number, * including a +Float+ with fractional seconds). Returns the actual number of * seconds slept (rounded), which may be less than that asked for if another * thread calls Thread#run. Zero arguments causes +sleep+ to sleep * forever. また、1.8 では起こせます。 % ruby-1.8 -ve ' t = Thread.new { t1 = Time.now sleep 5 t2 = Time.now p t2 - t1 } sleep 1 t.run t.join ' ruby 1.8.7 (2008-07-10 revision 17572) [i686-linux] 1.002687 -- [田中 哲][たなか あきら][Tanaka Akira]