class Concurrent::RubyFixedThreadPool

@!macro fixed_thread_pool

def initialize(num_threads, opts = {})

Raises:
  • (ArgumentError) - if `overflow_policy` is not a known policy
  • (ArgumentError) - if `num_threads` is less than or equal to zero

Options Hash: (**opts)
  • :overflow_policy (Symbol) -- the overflow policy

Parameters:
  • opts (Hash) -- the options defining pool behavior.
  • num_threads (Integer) -- the number of threads to allocate
def initialize(num_threads, opts = {})
  overflow_policy = opts.fetch(:overflow_policy, :abort)
  raise ArgumentError.new('number of threads must be greater than zero') if num_threads < 1
  raise ArgumentError.new("#{overflow_policy} is not a valid overflow policy") unless OVERFLOW_POLICIES.include?(overflow_policy)
  opts = opts.merge(
    min_threads: num_threads,
    max_threads: num_threads,
    num_threads: overflow_policy,
    max_queue: DEFAULT_MAX_QUEUE_SIZE,
    idletime: 0
  )
  super(opts)
end