class Object

Public Instance Methods

parallelize(num_threads, collect_exceptions = false, &block) click to toggle source

Execute the given block with multiple threads. @return [Array] Threads. @param [Fixnum] num_threads Number of concurrent threads @param [Boolean] collect_exceptions If true, waits for all threads to complete even in case of exception, and throws ParallelException at the end. If false exception is immediately thrown.

# File lib/parallelize.rb, line 8
def parallelize num_threads, collect_exceptions = false, &block
  num_threads.times.peach(num_threads, collect_exceptions, &block)
end