Method: PMap::ThreadPool#initialize
- Defined in:
- lib/pmap/thread_pool.rb
#initialize(max) ⇒ ThreadPool
Public: Initializes a new thread pool
max - the maximum number of threads to spawn
21 22 23 24 25 26 27 28 |
# File 'lib/pmap/thread_pool.rb', line 21 def initialize(max) raise ArgumentError, "max must be at least one." unless max.respond_to?(:>=) && max >= 1 @max = max @jobs = Queue.new @workers = [] end |