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

Synopsis

Declared in <bdlmt_fixedthreadpool.h>

class FixedThreadPool;

Type Aliases

Name

Description

Job

Defines a type alias for the job functor type.

Queue

Defines a type alias for the bounded job queue type.

Enums

Name

Description

Unnamed enum

Status codes returned by queue operations.

Unnamed enum

Thread‐pool operational states.

Member Functions

Name

Description

FixedThreadPool [constructor]

Constructors

~FixedThreadPool [destructor]

Remove all pending jobs from the queue without executing them, block until all currently running jobs complete, and then destroy this thread pool.

disable

Disable enqueueing into this pool.

drain

Drain queued and executing jobs without disabling this pool.

enable

Enable queuing into this pool. If the queue is not enqueue disabled, this call has no effect.

enqueueJob

enqueueJob overloads

isEnabled

Return true if enqueuing jobs is enabled on this thread pool, and false otherwise.

isStarted

Return true if numThreads() are started on this threadpool and false otherwise (indicating that 0 threads are started on this thread pool.)

numActiveThreads

Return a snapshot of the number of threads that are currently processing a job for this threadpool.

numPendingJobs

Return a snapshot of the number of jobs currently enqueued to be processed by thread pool.

numThreads

Return the number of threads passed to this thread pool at construction.

numThreadsStarted

Return a snapshot of the number of threads currently started by this thread pool.

queueCapacity

Return the capacity of the queue used to enqueue jobs by this thread pool.

shutdown

Shut down this thread pool.

start

Spawn processing threads and enable enqueuing.

stop

Disable enqueuing, wait for jobs to complete, and join worker threads.

tryEnqueueJob

tryEnqueueJob overloads

Created with MrDocs