This class implements a thread pool used for concurrently executing multiple user‐defined functions ("jobs").

Synopsis

Declared in <bdlmt_threadpool.h>

class ThreadPool;

Type Aliases

Name

Description

Job

Callable type representing a job to be executed by the thread pool.

Member Functions

Name

Description

ThreadPool [constructor]

Constructors

~ThreadPool [destructor]

Call shutdown() and destroy this thread pool.

drain

Disable queuing on this thread pool and wait until all pending jobs complete. Use start to re‐enable queuing.

enabled

Return the state (enabled or not) of the thread pool.

enqueueJob

enqueueJob overloads

maxIdleTime

Return the amount of time (in milliseconds) a thread remains idle before being shut down when there are more than min threads started.

maxIdleTimeInterval

Return the amount of time a thread remains idle before being shut down when there are more than min threads started.

maxThreads

Return the maximum number of threads that are allowed to be running at given time.

minThreads

Return the minimum number of threads that must be started at any given time.

numActiveThreads

Return the number of threads that are currently processing a job.

numPendingJobs

Return the number of jobs that are currently queued, but not yet being processed.

numWaitingThreads

Return the number of threads that are currently waiting for a job.

percentBusy

Return the percentage of wall time spent executing jobs.

resetPercentBusy

Report thread‐pool busy percentage since last reset.

shutdown

Disable queuing on this thread pool, cancel all queued jobs, and shut down all processing threads (after all active jobs complete).

start

Enable queuing and start processing threads.

stop

Disable queuing on this thread pool and wait until all pending jobs complete, then shut down all processing threads.

threadFailures

Return the number of times that thread creation failed.

operator BloombergLP::bslmf::NestedTraitDeclaration<ThreadPool, UsesBslmaAllocator>

Declare that this type uses a bslma allocator.

Friends

Name

Description

BloombergLP::bdlmt::ThreadPoolEntry

Entry point for processing threads.

Created with MrDocs