[#ThreadPool] = ThreadPool :mrdocs: Fixed‐size thread pool for running arbitrary tasks concurrently. == Synopsis Declared in `<util/threadpool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ThreadPool; ---- == Description Pool of worker threads used to fetch coins in parallel. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:ThreadPool/Future.adoc[`Future`] | Future type holding the result of a callable of type F. | xref:ThreadPool/PackagedTask.adoc[`PackagedTask`] | Packaged‐task type wrapping a callable of type F for queuing. | xref:ThreadPool/RangeFuture.adoc[`RangeFuture`] | Future type holding the result of invoking an element of range R. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:ThreadPool/SubmitError.adoc[`SubmitError`] | Reason a task submission was rejected by the pool. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:ThreadPool/2constructor.adoc[`ThreadPool`] [.small]#[constructor]# | Constructs an idle pool with a name used as a prefix for worker thread names. | xref:ThreadPool/2destructor.adoc[`~ThreadPool`] [.small]#[destructor]# | Stops the pool if still running and joins any remaining workers. | xref:ThreadPool/Interrupt.adoc[`Interrupt`] | Stop accepting new tasks and begin asynchronous shutdown. | xref:ThreadPool/ProcessTask.adoc[`ProcessTask`] | Execute a single queued task synchronously. Removes one task from the queue and executes it on the calling thread. | xref:ThreadPool/Start.adoc[`Start`] | Start worker threads. | xref:ThreadPool/Stop.adoc[`Stop`] | Stop all worker threads and wait for them to exit. | xref:ThreadPool/Submit-05.adoc[`Submit`] | `Submit` overloads | xref:ThreadPool/WorkQueueSize.adoc[`WorkQueueSize`] | Reports the number of tasks currently waiting in the queue. | xref:ThreadPool/WorkersCount.adoc[`WorkersCount`] | Reports the number of active worker threads. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#