MultipriorityThreadPool [constructor] | Create a multi-priority thread pool capable of concurrently executing the specified numThreads "jobs" with associated integer priorities in the specified range [0 .. numPriorities - 1], 0 being the most urgent. Optionally specify threadAttributes used to customize each worker thread created by this thread pool, in which case the attribute pertaining to whether the worker threads are created in the detached state is ignored. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The newly created thread pool will initially be enabled for enqueuing jobs, but with no worker threads created. The behavior is undefined unless 1 <= numThreads and 1 <= numPriorities <= k_MAX_NUM_PRIORITIES. |
~MultipriorityThreadPool [destructor] | Remove (cancel) all pending jobs and destroy this multi-priority thread pool. The behavior is undefined unless this thread pool is stopped. |
disableQueue | Disable the enqueuing of jobs to this multi-priority thread pool. When this thread pool is disabled, the status returned when calling either overloaded enqueueJob method will be non-zero, indicating that the job was not enqueued. Note that calling this method when the queue is already in the disabled state has no effect. |
drainJobs | 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: |
enableQueue | Enable the enqueuing of jobs to this multi-priority thread pool. When this thread pool is enabled, the status returned when calling either overloaded enqueueJob method will be 0, indicating that the job was successfully enqueued. Note that calling this method when the queue is already in the enabled state has no effect. |
enqueueJob | enqueueJob overloads |
isEnabled | Return true if the enqueuing of new jobs is enabled for this multi-priority thread pool, and false otherwise. |
isStarted | Return true if all numThreads() worker threads (specified at construction) have been created for this multi-priority thread pool, and false otherwise. |
isSuspended | Return true if the threads of this multi-priority thread pool are currently suspended from processing jobs, and false otherwise. |
numActiveThreads | Return a snapshot of the number of threads that are actively processing jobs for this multi-priority thread pool. Note that 0 <= numActiveThreads() <= numThreads() is an invariant of this class. |
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. |
numPriorities | Return the fixed number of priorities, specified at construction, that this multi-priority thread pool supports. |
numStartedThreads | Return the number of threads that have been started for this multi-priority thread pool. Note that they may be currently suspended. |
numThreads | Returns the fixed number of threads, specified at construction, that are started by this multi-priority thread pool. |
removeJobs | 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 drainJobs method. Note that, in this case, such undefined behavior may include deadlock. |
resumeProcessing | 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. |
shutdown | Disable the enqueuing of new jobs to this multi-priority thread pool, cancel all pending jobs, and stop all worker threads. |
startThreads | Create and start numThreads() worker threads in this multi-priority thread pool. Return 0 on success, and a non-zero value with no worker threads and no jobs processed otherwise. This method has no impact on the enabled/disabled or suspended/resumed states of this thread pool. Note that calling this method when this thread pool is already in the started state has no effect. Also note that until this method is called, the thread pool will not process any jobs. |
stopThreads | 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. |
suspendProcessing | 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 resumeProcessing() is called. This is orthogonal to start/stop, and enable/disable; no threads are stopped. If this thread pool is started, this call blocks until all threads have finished any jobs they were processing and have gone into suspension. This method has no effect if this thread pool was already in the suspended state. Note that calling this method from one of the threads belonging to this thread pool will cause a deadlock. |
operator BloombergLP::bslmf::NestedTraitDeclaration<MultipriorityThreadPool, UsesBslmaAllocator> | Declare that this type uses a bslma allocator. |