lib/bundler/worker.rb in bundler-1.10.6 vs lib/bundler/worker.rb in bundler-1.11.0.pre.1

- old
+ new

@@ -1,6 +1,6 @@ -require 'thread' +require "thread" module Bundler class Worker POISON = Object.new @@ -17,11 +17,11 @@ # @param func [Proc] job to run in inside the worker pool def initialize(size, func) @request_queue = Queue.new @response_queue = Queue.new @func = func - @threads = size.times.map { |i| Thread.start { process_queue(i) } } + @threads = size.times.map {|i| Thread.start { process_queue(i) } } trap("INT") { abort_threads } end # Enqueue a request to be executed in the worker pool # @@ -59,15 +59,14 @@ # Stop the worker threads by sending a poison object down the request queue # so as worker threads after retrieving it, shut themselves down def stop_threads @threads.each { @request_queue.enq POISON } - @threads.each { |thread| thread.join } + @threads.each(&:join) end def abort_threads - @threads.each {|i| i.exit } + @threads.each(&:exit) exit 1 end - end end