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.
Synopsis
Declared in <bdlmt_multiprioritythreadpool.h>
class MultipriorityThreadPool;
Type Aliases
Name |
Description |
|
Enums
Name |
Description |
Maximum number of distinct job priorities supported by this pool. |
Member Functions
Name |
Description |
|
Create a multi‐priority thread pool capable of concurrently executing the specified |
|
Remove (cancel) all pending jobs and destroy this multi‐priority thread pool. The behavior is undefined unless this thread pool is stopped. |
Disable the enqueuing of jobs to this multi‐priority thread pool. When this thread pool is disabled, the status returned when calling either overloaded |
|
Block until all executing jobs and pending jobs enqueued to this multi‐priority thread pool complete. This method does not affect the enabled/disabled state of this thread pool. If this thread pool is enabled and jobs are enqueued during draining, this method may return before all enqueued jobs are executed. The behavior is undefined if: |
|
Enable the enqueuing of jobs to this multi‐priority thread pool. When this thread pool is enabled, the status returned when calling either overloaded |
|
|
|
Return |
|
Return |
|
Return |
|
Return a snapshot of the number of threads that are actively processing jobs for this multi‐priority thread pool. Note that |
|
Return a snapshot of the number of jobs currently enqueued to be processed by this multi‐priority thread pool, but are not yet running. |
|
Return the fixed number of priorities, specified at construction, that this multi‐priority thread pool supports. |
|
Return the number of threads that have been started for this multi‐priority thread pool. Note that they may be currently suspended. |
|
Returns the fixed number of threads, specified at construction, that are started by this multi‐priority thread pool. |
|
Remove all pending (i.e., not yet active) jobs from the queue of this multi‐priority thread pool. This method does not affect the enabled status of the queue, nor does it affect the started status or any active jobs in this thread pool. The behavior is undefined if this method is called concurrently with the |
|
If this multi‐priority thread pool is suspended, resume processing of jobs. This is orthogonal to start/stop, and enable/disable; no threads are started. Note that this method has no effect if this thread pool is not in the suspended state. |
|
Disable the enqueuing of new jobs to this multi‐priority thread pool, cancel all pending jobs, and stop all worker threads. |
|
Create and start |
|
Destroy all worker threads of this multi‐priority thread pool after waiting for any active (i.e., already‐running) jobs to complete; no new jobs will be allowed to become active. This method has no impact on the enabled/disabled or suspended/resumed states of this thread pool. Note that calling this function when this thread pool is not in the started state has no effect. Also note that calling this method from one of the threads belonging to this thread pool will cause a deadlock. |
|
Put this multi‐priority thread pool into the suspended state. This method does not suspend any jobs that have begun to execute; such jobs are allowed to complete. No pending jobs, however, will be allowed to begin execution until |
|
|
Declare that this type uses a |
Created with MrDocs