lib/rainbows/queue_pool.rb in rainbows-3.0.0 vs lib/rainbows/queue_pool.rb in rainbows-3.1.0

- old
+ new

@@ -4,15 +4,15 @@ # Thread pool class based on pulling off a single Ruby Queue. # This is NOT used for the ThreadPool class, since that class does not # need a userspace Queue. class Rainbows::QueuePool < Struct.new(:queue, :threads) - def initialize(size = 20, &block) + def initialize(size = 20) q = Queue.new self.threads = (1..size).map do Thread.new do while job = q.shift - block.call(job) + yield job end end end self.queue = q end