[#BloombergLP-bdlmt-MultipriorityThreadPool]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::MultipriorityThreadPool
:relfileprefix: ../../
:mrdocs:

Thread pool that executes jobs according to integral priorities&period;

== Synopsis

Declared in `&lt;bdlmt&lowbar;multiprioritythreadpool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class MultipriorityThreadPool;
----

== Description

This class implements a thread&hyphen;enabled, integrally&hyphen;prioritized thread&hyphen;pool mechanism used for concurrently executing multiple user&hyphen;defined &quot;jobs&quot; supplied as either conventional C&hyphen;style functions taking an optional `void &ast;` data argument, or as more flexible functor objects&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/ThreadFunctor.adoc[`ThreadFunctor`] 
| Type alias for a nullary function object that returns `void`&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/_04enum.adoc[`Unnamed enum`] 
| Maximum number of distinct job priorities supported by this pool&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/2constructor-0a.adoc[`MultipriorityThreadPool`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/2destructor.adoc[`&#126;MultipriorityThreadPool`] [.small]#[destructor]#
| Remove (cancel) all pending jobs and destroy this multi&hyphen;priority thread pool&period; The behavior is undefined unless this thread pool is stopped&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/disableQueue.adoc[`disableQueue`] 
| Disable enqueuing of jobs to this thread pool&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/drainJobs.adoc[`drainJobs`] 
| Block until all executing and pending jobs complete&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/enableQueue.adoc[`enableQueue`] 
| Enable enqueuing of jobs to this thread pool&period;
| 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&hyphen;priority thread pool, and `false` otherwise&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/isStarted.adoc[`isStarted`] 
| Return `true` if all `numThreads()` worker threads (specified at construction) have been created for this multi&hyphen;priority thread pool, and `false` otherwise&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/isSuspended.adoc[`isSuspended`] 
| Return `true` if the threads of this multi&hyphen;priority thread pool are currently suspended from processing jobs, and `false` otherwise&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/numActiveThreads.adoc[`numActiveThreads`] 
| Return a snapshot of the number of threads currently processing jobs&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/numPendingJobs.adoc[`numPendingJobs`] 
| Return a snapshot of the number of jobs currently enqueued to be processed by this multi&hyphen;priority thread pool, but are not yet running&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/numPriorities.adoc[`numPriorities`] 
| Return the fixed number of priorities, specified at construction, that this multi&hyphen;priority thread pool supports&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/numStartedThreads.adoc[`numStartedThreads`] 
| Return the number of threads that have been started for this multi&hyphen;priority thread pool&period; Note that they may be currently suspended&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/numThreads.adoc[`numThreads`] 
| Returns the fixed number of threads, specified at construction, that are started by this multi&hyphen;priority thread pool&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/removeJobs.adoc[`removeJobs`] 
| Remove all pending jobs from the queue of this thread pool&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/resumeProcessing.adoc[`resumeProcessing`] 
| Resume job processing if this thread pool is suspended&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/shutdown.adoc[`shutdown`] 
| Disable the enqueuing of new jobs to this multi&hyphen;priority thread pool, cancel all pending jobs, and stop all worker threads&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/startThreads.adoc[`startThreads`] 
| Create and start the worker threads of this thread pool&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/stopThreads.adoc[`stopThreads`] 
| Destroy all worker threads after active jobs complete&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/suspendProcessing.adoc[`suspendProcessing`] 
| Put this thread pool into the suspended state&period;
| xref:BloombergLP/bdlmt/MultipriorityThreadPool/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;MultipriorityThreadPool, UsesBslmaAllocator&gt;`] 
| Declare that this type uses a `bslma` allocator&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
