# # thread.rb - thread support classes # $Date$ # by Yukihiro Matsumoto # unless defined? Thread fail "Thread not available for this ruby interpreter" end unless defined? ThreadError class ThreadError= @max @queue_wait.push Thread.current Thread.stop end super end def pop(*args) if @que.length < @max t = @queue_wait.shift t.run if t end pop = super pop end def num_waiting @waiting.size + @queue_wait.size end end