A simple thread pool management object.
Maintain a minimum of min and maximum of max threads in the pool.
The block passed is the work that will be performed in each thread.
# File lib/puma/thread_pool.rb, line 14 def initialize(min, max, &blk) @cond = ConditionVariable.new @mutex = Mutex.new @todo = [] @spawned = 0 @waiting = 0 @min = min @max = max @block = blk @shutdown = false @trim_requested = 0 @workers = [] @auto_trim = nil @mutex.synchronize do min.times { spawn_thread } end end
Generated with the Darkfish Rdoc Generator 2.