This class implements a thread pool used for concurrently executing multiple user‐defined functions ("jobs").
Synopsis
Declared in <bdlmt_threadpool.h>
class ThreadPool;
Type Aliases
Name |
Member Functions
Name |
Description |
|
Constructors |
|
Call |
Disable queuing on this thread pool and wait until all pending jobs complete. Use |
|
Return the state (enabled or not) of the thread pool. |
|
|
|
Return the amount of time (in milliseconds) a thread remains idle before being shut down when there are more than min threads started. |
|
Return the amount of time a thread remains idle before being shut down when there are more than min threads started. |
|
Return the maximum number of threads that are allowed to be running at given time. |
|
Return the minimum number of threads that must be started at any given time. |
|
Return the number of threads that are currently processing a job. |
|
Return the number of jobs that are currently queued, but not yet being processed. |
|
Return the number of threads that are currently waiting for a job. |
|
Return the percentage of wall time spent by each thread of this thread pool executing jobs since the last reset time. The creation of the thread pool is considered a first reset time. This value is calculated as: ` sum(jobExecutionTime) 100% P_busy = ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ x ‐‐‐‐‐‐‐‐‐‐ timeSinceLastReset maxThreads ` Note that this percentage reflects the wall time spent per thread, and not CPU time per thread, or not even CPU time per processor. Also note that there is no guarantee that all threads are processed concurrently (e.g., the number of threads could be larger than the number of processors). |
|
Atomically report the percentage of wall time spent by each thread of this thread pool executing jobs since the last reset time, and set the reset time to now. The creation of the thread pool is considered a first reset time. This value is calculated as: ` sum(jobExecutionTime) 100% P_busy = ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ x ‐‐‐‐‐‐‐‐‐‐ timeSinceLastReset maxThreads ` Note that this percentage reflects the wall time spent per thread, and not CPU time per thread, or not even CPU time per processor. Also note that there is no guarantee that all threads are processed concurrently (e.g., the number of threads could be larger than the number of processors). |
|
Disable queuing on this thread pool, cancel all queued jobs, and shut down all processing threads (after all active jobs complete). |
|
Enable queuing on this thread pool and spawn |
|
Disable queuing on this thread pool and wait until all pending jobs complete, then shut down all processing threads. |
|
Return the number of times that thread creation failed. |
|
|
Declare that this type uses a |
Friends
Name |
Description |
Entry point for processing threads. |
Created with MrDocs