Sha256: be380669e8302c9b60b463211ecabc28c3dc2c58d5c21946cf6fe678a611d0b1

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

module Tobox
  class Pool
    def initialize(configuration)
      @configuration = configuration
      @num_workers = configuration[:concurrency]
      @workers = Array.new(@num_workers) { Worker.new(configuration) }
      start
    end

    def stop
      @workers.each(&:finish!)
    end
  end

  autoload :ThreadedPool, File.join(__dir__, "pool", "threaded_pool")
  autoload :FiberPool, File.join(__dir__, "pool", "fiber_pool")
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tobox-0.1.0 lib/tobox/pool.rb