[#ThreadPool]
= ThreadPool
:mrdocs:

Fixed&hyphen;size thread pool for running arbitrary tasks concurrently&period;

== Synopsis

Declared in `&lt;util&sol;threadpool&period;h&gt;`

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

== Description

Pool of worker threads used to fetch coins in parallel&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:ThreadPool/Future.adoc[`Future`] 
| Future type holding the result of a callable of type F&period;
| xref:ThreadPool/PackagedTask.adoc[`PackagedTask`] 
| Packaged&hyphen;task type wrapping a callable of type F for queuing&period;
| xref:ThreadPool/RangeFuture.adoc[`RangeFuture`] 
| Future type holding the result of invoking an element of range R&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:ThreadPool/SubmitError.adoc[`SubmitError`] 
| Reason a task submission was rejected by the pool&period;
|===


== 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&period;
| xref:ThreadPool/2destructor.adoc[`&#126;ThreadPool`] [.small]#[destructor]#
| Stops the pool if still running and joins any remaining workers&period;
| xref:ThreadPool/Interrupt.adoc[`Interrupt`] 
| Stop accepting new tasks and begin asynchronous shutdown&period;
| xref:ThreadPool/ProcessTask.adoc[`ProcessTask`] 
| Execute a single queued task synchronously&period; Removes one task from the queue and executes it on the calling thread&period;
| xref:ThreadPool/Start.adoc[`Start`] 
| Start worker threads&period;
| xref:ThreadPool/Stop.adoc[`Stop`] 
| Stop all worker threads and wait for them to exit&period;
| xref:ThreadPool/Submit-05.adoc[`Submit`] 
| `Submit` overloads
| xref:ThreadPool/WorkQueueSize.adoc[`WorkQueueSize`] 
| Reports the number of tasks currently waiting in the queue&period;
| xref:ThreadPool/WorkersCount.adoc[`WorkersCount`] 
| Reports the number of active worker threads&period;
|===



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