Method: Workhorse::Pool#initialize

Defined in:
lib/workhorse/pool.rb

#initialize(size) ⇒ Pool

Returns a new instance of Pool.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/workhorse/pool.rb', line 6

def initialize(size)
  @size = size
  @executor = Concurrent::ThreadPoolExecutor.new(
    min_threads: 0,
    max_threads: @size,
    max_queue: 0,
    fallback_policy: :abort,
    auto_terminate: false
  )
  @mutex = Mutex.new
  @active_threads = Concurrent::AtomicFixnum.new(0)
  @on_idle = nil
end