Sha256: b9eb0572c9aae1a4b40dc47e6afc110903f17ca2694b8a2ce65daaa54f13382f

Contents?: true

Size: 512 Bytes

Versions: 6

Compression:

Stored size: 512 Bytes

Contents

# frozen_string_literal: true

module Tobox
  class Pool
    def initialize(configuration)
      @configuration = configuration
      @num_workers = configuration[:concurrency]
      @workers = Array.new(@num_workers) do |idx|
        Worker.new("tobox-worker-#{idx}", configuration)
      end
      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

6 entries across 6 versions & 1 rubygems

Version Path
tobox-0.1.6 lib/tobox/pool.rb
tobox-0.1.5 lib/tobox/pool.rb
tobox-0.1.4 lib/tobox/pool.rb
tobox-0.1.3 lib/tobox/pool.rb
tobox-0.1.2 lib/tobox/pool.rb
tobox-0.1.1 lib/tobox/pool.rb