All pastes #53546 Raw Edit

Something

public text v1 · immutable
#53546 ·published 2006-05-04 15:22 UTC
rendered paste body
class Dummy
  def walk(host)
    puts "walking host ... #{host}."
    sleep ( rand ( 10 ) )
  end
  def close
  end
end

stack = []

200.times do |y|
  stack.push(y)
end

runner = PooledRunner.new(Dummy, 10, [], true)
while stack.size > 0 do
  runner.run() do |handler|
    handler.walk(stack.pop)
  end
end
runner.wait_for_all
runner.close_handlers