[1 ytti@eng0.dllstx09.us.to.gin.ntt.net ~/tmp]% cat tst.rb
#!/usr/bin/env ruby

require 'pry'

class Test
  def initialize
    result = []
    threads = []
    10000.times do |number|
      while threads.size > 50
        sleep 0.01
        deleted = []
        threads.delete_if { |thread| deleted << thread  if not thread.alive? }
        deleted.each { |thread| thread.kill }
      end
      binding.pry if File.exist? 'test.pry'
      threads << Thread.new {
        result[number] = rand(100000)
        sleep rand(10)/10.0
      }
    end
    threads.each { |thread| thread.join }
    binding.pry
  end
end

Test.new
[ytti@eng0.dllstx09.us.to.gin.ntt.net ~/tmp]%