class ChefUtils::DefaultThreadPool
the depth of recursion).
number of threads (and not exponentially growing the thread pool with
be called recursively without deadlocking and while keeping the fixed
caller to run the work. This contract means that the thread pool can
queue of work and the behavior on failure to find a thread is for the
The DefaultThreadPool has a fixed thread size and has no
def pool
-
(Concurrent::ThreadPoolExecutor)
- the thread pool
def pool @pool ||= Concurrent::ThreadPoolExecutor.new( min_threads: threads || DEFAULT_THREAD_SIZE, max_threads: threads || DEFAULT_THREAD_SIZE, max_queue: 0, # "synchronous" redefines the 0 in max_queue to mean 'no queue' instead of 'infinite queue' # it does not mean synchronous execution (no threads) but synchronous offload to the threads. synchronous: true, # this prevents deadlocks on recursive parallel usage fallback_policy: :caller_runs ) end