CCheckQueue

Queue for verifications that have to be performed. The verifications are represented by a type T, which must provide an operator(), returning an std::optional<R>.

Synopsis

Declared in <checkqueue.h>

template<
    typename T,
    typename R = std::remove_cvref_t<decltype(std::declval<T>()().value())>>
class CCheckQueue;

Description

The overall result of the computation is std::nullopt if all invocations return std::nullopt, or one of the other results otherwise.

One thread (the master) is assumed to push batches of verifications onto the queue, where they are processed by N-1 worker threads. When the master is done adding work, it temporarily joins the worker pool as an N'th worker, until all jobs are done.

Member Functions

NameDescription
CCheckQueue [constructor]Constructors
~CCheckQueue [destructor]Stops all worker threads and joins them before destruction.
operator= Assignment operators
Add Add a batch of checks to the queue
Complete Join the execution until completion. If at least one evaluation wasn't successful, return its error.
HasThreads Returns true if the queue has any worker threads.

Data Members

NameDescription
m_control_mutex Mutex to ensure only one concurrent CCheckQueueControl