Method: ThreadPool#threads

Defined in:
lib/nswtopo/helpers/thread_pool.rb

#threads(queue, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/nswtopo/helpers/thread_pool.rb', line 12

def threads(queue, &block)
  @size.times.map do
    Thread.new do
      while args = queue.pop
        block.call(*args)
      end
    end
  end
end