Fixed‐size thread pool for running arbitrary tasks concurrently.

Synopsis

Declared in <util/threadpool.h>

class ThreadPool;

Description

Pool of worker threads used to fetch coins in parallel.

Type Aliases

Name

Description

Future

Future type holding the result of a callable of type F.

PackagedTask

Packaged‐task type wrapping a callable of type F for queuing.

RangeFuture

Future type holding the result of invoking an element of range R.

Enums

Name

Description

SubmitError

Reason a task submission was rejected by the pool.

Member Functions

Name

Description

ThreadPool [constructor]

Constructs an idle pool with a name used as a prefix for worker thread names.

~ThreadPool [destructor]

Stops the pool if still running and joins any remaining workers.

Interrupt

Stop accepting new tasks and begin asynchronous shutdown.

ProcessTask

Execute a single queued task synchronously. Removes one task from the queue and executes it on the calling thread.

Start

Start worker threads.

Stop

Stop all worker threads and wait for them to exit.

Submit

Submit overloads

WorkQueueSize

Reports the number of tasks currently waiting in the queue.

WorkersCount

Reports the number of active worker threads.

Created with MrDocs