[#BloombergLP-bdlmt-ThreadPool-2constructor-0a3]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::xref:BloombergLP/bdlmt/ThreadPool.adoc[ThreadPool]::ThreadPool
:relfileprefix: ../../../
:mrdocs:

Construct a thread pool with the specified `threadPoolName`&period;

== Synopsis

Declared in `&lt;bdlmt&lowbar;threadpool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
ThreadPool(
    xref:BloombergLP/bslmt/ThreadAttributes.adoc[bslmt::ThreadAttributes] const& threadAttributes,
    int minThreads,
    int maxThreads,
    int maxIdleTime,
    std::string&lowbar;view const& threadPoolName,
    xref:BloombergLP/bdlm/MetricsRegistry.adoc[bdlm::MetricsRegistry]* metricsRegistry,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0);
----

== Description

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&period; If `metricsRegistry` is 0, `bdlm&colon;&colon;MetricsRegistry&colon;&colon;singleton()` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; The name used for created threads is `threadAttributes&period;threadName()` if not empty, otherwise `threadPoolName` if not empty, otherwise &quot;bdl&period;ThreadPool&quot;&period; The behavior is undefined unless `0 &lt;&equals; minThreads`, `minThreads &lt;&equals; maxThreads`, and `0 &lt;&equals; maxIdleTime`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *threadAttributes*
| attributes used when creating worker threads
| *minThreads*
| minimum number of worker threads
| *maxThreads*
| maximum number of worker threads
| *maxIdleTime*
| idle time in milliseconds before a thread may exit
| *threadPoolName*
| name identifying this thread pool
| *metricsRegistry*
| metrics registry, or singleton if 0
| *basicAllocator*
| memory allocator&semi; null uses the default
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
