Construct a thread pool with a TimeInterval idle time.
Declared in <bdlmt_threadpool.h>
ThreadPool(
bslmt::ThreadAttributes const& threadAttributes,
int minThreads,
int maxThreads,
bsls::TimeInterval maxIdleTime,
bslma::Allocator* basicAllocator = 0);
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.
| Name | Description |
|---|---|
| threadAttributes | attributes used when creating worker threads |
| minThreads | minimum number of worker threads |
| maxThreads | maximum number of worker threads |
| maxIdleTime | idle time before a thread may exit |
| basicAllocator | memory allocator; null uses the default |