Creates a worker pool of specified size
@param size [Integer] Size of pool @param func [Proc] job to run in inside the worker pool
# File lib/bundler/parallel_workers/worker.rb, line 17 def initialize(size, func) @request_queue = Queue.new @response_queue = Queue.new prepare_workers size, func prepare_threads size trap("INT") { @threads.each {|i| i.exit }; stop_workers; exit 1 } end
Retrieves results of job function being executed in worker pool
# File lib/bundler/parallel_workers/worker.rb, line 33 def deq result = @response_queue.deq if result.is_a?(WrappedException) raise result.exception end result end
Generated with the Darkfish Rdoc Generator 2.