Object
# File lib/rubygems/mirror/pool.rb, line 4 def initialize(size) @size = size @queue = Queue.new end
# File lib/rubygems/mirror/pool.rb, line 9 def job(&blk) @queue << blk end
# File lib/rubygems/mirror/pool.rb, line 13 def run_til_done threads = Array.new(@size) do Thread.new { @queue.pop.call while true } end until @queue.empty? && @queue.num_waiting == @size threads.each { |t| t.join(0.1) } end threads.each { |t| t.kill } end
[Validate]
Generated with the Darkfish Rdoc Generator 2.