[#BloombergLP-bdlmt-ThreadPool] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::ThreadPool :relfileprefix: ../../ :mrdocs: This class implements a thread pool used for concurrently executing multiple user‐defined functions ("jobs"). == Synopsis Declared in `<bdlmt_threadpool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ThreadPool; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/ThreadPool/Job.adoc[`Job`] | Callable type representing a job to be executed by the thread pool. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/ThreadPool/2constructor-0e.adoc[`ThreadPool`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlmt/ThreadPool/2destructor.adoc[`~ThreadPool`] [.small]#[destructor]# | Call `shutdown()` and destroy this thread pool. | xref:BloombergLP/bdlmt/ThreadPool/drain.adoc[`drain`] | Disable queuing on this thread pool and wait until all pending jobs complete. Use `start` to re‐enable queuing. | xref:BloombergLP/bdlmt/ThreadPool/enabled.adoc[`enabled`] | Return the state (enabled or not) of the thread pool. | xref:BloombergLP/bdlmt/ThreadPool/enqueueJob-0e.adoc[`enqueueJob`] | `enqueueJob` overloads | xref:BloombergLP/bdlmt/ThreadPool/maxIdleTime.adoc[`maxIdleTime`] | Return the amount of time (in milliseconds) a thread remains idle before being shut down when there are more than min threads started. | xref:BloombergLP/bdlmt/ThreadPool/maxIdleTimeInterval.adoc[`maxIdleTimeInterval`] | Return the amount of time a thread remains idle before being shut down when there are more than min threads started. | xref:BloombergLP/bdlmt/ThreadPool/maxThreads.adoc[`maxThreads`] | Return the maximum number of threads that are allowed to be running at given time. | xref:BloombergLP/bdlmt/ThreadPool/minThreads.adoc[`minThreads`] | Return the minimum number of threads that must be started at any given time. | xref:BloombergLP/bdlmt/ThreadPool/numActiveThreads.adoc[`numActiveThreads`] | Return the number of threads that are currently processing a job. | xref:BloombergLP/bdlmt/ThreadPool/numPendingJobs.adoc[`numPendingJobs`] | Return the number of jobs that are currently queued, but not yet being processed. | xref:BloombergLP/bdlmt/ThreadPool/numWaitingThreads.adoc[`numWaitingThreads`] | Return the number of threads that are currently waiting for a job. | xref:BloombergLP/bdlmt/ThreadPool/percentBusy.adoc[`percentBusy`] | Return the percentage of wall time spent executing jobs. | xref:BloombergLP/bdlmt/ThreadPool/resetPercentBusy.adoc[`resetPercentBusy`] | Report thread‐pool busy percentage since last reset. | xref:BloombergLP/bdlmt/ThreadPool/shutdown.adoc[`shutdown`] | Disable queuing on this thread pool, cancel all queued jobs, and shut down all processing threads (after all active jobs complete). | xref:BloombergLP/bdlmt/ThreadPool/start.adoc[`start`] | Enable queuing and start processing threads. | xref:BloombergLP/bdlmt/ThreadPool/stop.adoc[`stop`] | Disable queuing on this thread pool and wait until all pending jobs complete, then shut down all processing threads. | xref:BloombergLP/bdlmt/ThreadPool/threadFailures.adoc[`threadFailures`] | Return the number of times that thread creation failed. | xref:BloombergLP/bdlmt/ThreadPool/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<ThreadPool, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlmt/ThreadPoolEntry.adoc[BloombergLP::bdlmt::ThreadPoolEntry]` | Entry point for processing threads. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#