[#BloombergLP-bdlmt-ThreadPool-2constructor-0e] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::xref:BloombergLP/bdlmt/ThreadPool.adoc[ThreadPool]::ThreadPool :relfileprefix: ../../../ :mrdocs: Constructors == Synopses Declared in `<bdlmt_threadpool.h>` Construct a thread pool with the specified `threadAttributes`, the specified `minThreads` minimum number of threads, the specified `maxThreads` maximum number of threads, and the specified `maxIdleTime` idle time after which a thread may be considered for destruction. 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 `threadAttributes.threadName()` if not empty, otherwise "bdl.ThreadPool". The behavior is undefined unless `0 <= minThreads`, `minThreads <= maxThreads`, `0 <= maxIdleTime`, and the `maxIdleTime` has a value less than or equal to `INT_MAX` milliseconds. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlmt/ThreadPool/2constructor-0b.adoc[ThreadPool]( xref:BloombergLP/bslmt/ThreadAttributes.adoc[bslmt::ThreadAttributes] const& threadAttributes, int minThreads, int maxThreads, xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval] maxIdleTime, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlmt/ThreadPool/2constructor-0b.adoc[_» more..._]# Construct a thread pool with the specified `threadAttributes`, the specified `minThreads` minimum number of threads, the specified `maxThreads` maximum number of threads, and the specified `maxIdleTime` idle time (in milliseconds) after which a thread may be considered for destruction. 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 `threadAttributes.threadName()` if not empty, otherwise "bdl.ThreadPool". The behavior is undefined unless `0 <= minThreads`, `minThreads <= maxThreads`, and `0 <= maxIdleTime`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlmt/ThreadPool/2constructor-01.adoc[ThreadPool]( xref:BloombergLP/bslmt/ThreadAttributes.adoc[bslmt::ThreadAttributes] const& threadAttributes, int minThreads, int maxThreads, int maxIdleTime, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlmt/ThreadPool/2constructor-01.adoc[_» more..._]# Construct a thread pool with the specified `threadAttributes`, the specified `minThreads` minimum number of threads, the specified `maxThreads` maximum number of threads, the specified `maxIdleTime` idle time after which a thread may be considered for destruction, 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 `threadAttributes.threadName()` if not empty, otherwise `threadPoolName` if not empty, otherwise "bdl.ThreadPool". The behavior is undefined unless `0 <= minThreads`, `minThreads <= maxThreads`, `0 <= maxIdleTime`, and the `maxIdleTime` has a value less than or equal to `INT_MAX` milliseconds. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlmt/ThreadPool/2constructor-0a2.adoc[ThreadPool]( xref:BloombergLP/bslmt/ThreadAttributes.adoc[bslmt::ThreadAttributes] const& threadAttributes, int minThreads, int maxThreads, xref:BloombergLP/bsls/TimeInterval.adoc[bsls::TimeInterval] maxIdleTime, std::string_view const& threadPoolName, xref:BloombergLP/bdlm/MetricsRegistry.adoc[bdlm::MetricsRegistry]* metricsRegistry, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlmt/ThreadPool/2constructor-0a2.adoc[_» more..._]# Construct a thread pool with the specified `threadAttributes`, the specified `minThreads` minimum number of threads, the specified `maxThreads` maximum number of threads, the specified `maxIdleTime` idle time (in milliseconds) after which a thread may be considered for destruction, 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 `threadAttributes.threadName()` if not empty, otherwise `threadPoolName` if not empty, otherwise "bdl.ThreadPool". The behavior is undefined unless `0 <= minThreads`, `minThreads <= maxThreads`, and `0 <= maxIdleTime`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bdlmt/ThreadPool/2constructor-0a3.adoc[ThreadPool]( xref:BloombergLP/bslmt/ThreadAttributes.adoc[bslmt::ThreadAttributes] const& threadAttributes, int minThreads, int maxThreads, int maxIdleTime, std::string_view const& threadPoolName, xref:BloombergLP/bdlm/MetricsRegistry.adoc[bdlm::MetricsRegistry]* metricsRegistry, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- [.small]#xref:BloombergLP/bdlmt/ThreadPool/2constructor-0a3.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#