BloombergLP::bdlmt::FixedThreadPool::FixedThreadPool

Construct a thread pool with the specified threadPoolName.

Synopsis

Declared in <bdlmt_fixedthreadpool.h>

FixedThreadPool(
    int numThreads,
    int maxNumPendingJobs,
    std::string_view const& threadPoolName,
    bdlm::MetricsRegistry* metricsRegistry,
    bslma::Allocator* basicAllocator = 0);

Description

Construct a thread pool with the specified numThreads number of threads, a job queue of capacity sufficient to enqueue the specified maxNumPendingJobs without blocking, the specified threadPoolName to be used to identify this thread pool, and the specified metricsRegistry to be used for reporting metrics. If metricsRegistry is 0, bdlm::MetricsRegistry::singleton() is used. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The name used for created threads is threadPoolName if not empty, otherwise "bdl.FixedPool". The behavior is undefined unless 1 <= numThreads. Note that the actual job queue capacity can be obtained using queueCapacity, and may be more than maxNumPendingJobs.

Parameters

NameDescription
numThreadsnumber of processing threads
maxNumPendingJobscapacity of the pending-job queue
threadPoolNamename identifying this thread pool
metricsRegistrymetrics registry, or singleton if 0
basicAllocatormemory allocator; null uses the default