num_waiting -> IntegerRuby 2.1.0 から[permalink][rdoc][edit]-
キューを待っているスレッドの数を返します。
例q = Thread::SizedQueue.new(1) q.push(1) t = Thread.new { q.push(2) } sleep 0.05 until t.stop? p q.num_waiting # => 1 q.pop t.join
このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ
num_waiting -> IntegerRuby 2.1.0 から[permalink][rdoc][edit]キューを待っているスレッドの数を返します。
例q = Thread::SizedQueue.new(1)
q.push(1)
t = Thread.new { q.push(2) }
sleep 0.05 until t.stop?
p q.num_waiting # => 1
q.pop
t.join