[#BloombergLP-bdlmt-MultipriorityThreadPool] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::MultipriorityThreadPool :relfileprefix: ../../ :mrdocs: Thread pool that executes jobs according to integral priorities. == Synopsis Declared in `<bdlmt_multiprioritythreadpool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class MultipriorityThreadPool; ---- == Description This class implements a thread‐enabled, integrally‐prioritized thread‐pool mechanism used for concurrently executing multiple user‐defined "jobs" supplied as either conventional C‐style functions taking an optional `void *` data argument, or as more flexible functor objects. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/MultipriorityThreadPool/ThreadFunctor.adoc[`ThreadFunctor`] | Type alias for a nullary function object that returns `void`. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/MultipriorityThreadPool/_04enum.adoc[`Unnamed enum`] | Maximum number of distinct job priorities supported by this pool. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlmt/MultipriorityThreadPool/2constructor-0a.adoc[`MultipriorityThreadPool`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlmt/MultipriorityThreadPool/2destructor.adoc[`~MultipriorityThreadPool`] [.small]#[destructor]# | Remove (cancel) all pending jobs and destroy this multi‐priority thread pool. The behavior is undefined unless this thread pool is stopped. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/disableQueue.adoc[`disableQueue`] | Disable enqueuing of jobs to this thread pool. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/drainJobs.adoc[`drainJobs`] | Block until all executing and pending jobs complete. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/enableQueue.adoc[`enableQueue`] | Enable enqueuing of jobs to this thread pool. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/enqueueJob-0f.adoc[`enqueueJob`] | `enqueueJob` overloads | xref:BloombergLP/bdlmt/MultipriorityThreadPool/isEnabled.adoc[`isEnabled`] | Return `true` if the enqueuing of new jobs is enabled for this multi‐priority thread pool, and `false` otherwise. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/isStarted.adoc[`isStarted`] | Return `true` if all `numThreads()` worker threads (specified at construction) have been created for this multi‐priority thread pool, and `false` otherwise. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/isSuspended.adoc[`isSuspended`] | Return `true` if the threads of this multi‐priority thread pool are currently suspended from processing jobs, and `false` otherwise. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/numActiveThreads.adoc[`numActiveThreads`] | Return a snapshot of the number of threads currently processing jobs. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/numPendingJobs.adoc[`numPendingJobs`] | Return a snapshot of the number of jobs currently enqueued to be processed by this multi‐priority thread pool, but are not yet running. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/numPriorities.adoc[`numPriorities`] | Return the fixed number of priorities, specified at construction, that this multi‐priority thread pool supports. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/numStartedThreads.adoc[`numStartedThreads`] | Return the number of threads that have been started for this multi‐priority thread pool. Note that they may be currently suspended. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/numThreads.adoc[`numThreads`] | Returns the fixed number of threads, specified at construction, that are started by this multi‐priority thread pool. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/removeJobs.adoc[`removeJobs`] | Remove all pending jobs from the queue of this thread pool. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/resumeProcessing.adoc[`resumeProcessing`] | Resume job processing if this thread pool is suspended. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/shutdown.adoc[`shutdown`] | Disable the enqueuing of new jobs to this multi‐priority thread pool, cancel all pending jobs, and stop all worker threads. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/startThreads.adoc[`startThreads`] | Create and start the worker threads of this thread pool. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/stopThreads.adoc[`stopThreads`] | Destroy all worker threads after active jobs complete. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/suspendProcessing.adoc[`suspendProcessing`] | Put this thread pool into the suspended state. | xref:BloombergLP/bdlmt/MultipriorityThreadPool/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<MultipriorityThreadPool, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#