48 std::string
const & name
59 throw invalid_error(
"a worker object must be given a valid input FIFO");
std::shared_ptr< fifo_type > pointer_t
A smart pointer to the FIFO.
Lock a mutex in an RAII manner.
The runner is the class that wraps the actual system thread.
virtual bool continue_running() const
Whether the thread should continue running.
mutex f_mutex
The mutex of this thread.
A runner augmentation allowing for worker threads.
fifo< T >::pointer_t f_in
The input fifo.
size_t runs() const
Number of time this worker got used.
std::size_t position() const
Get the worker thread position.
T f_payload
The payload this worker is processing.
std::size_t const f_position
The position of this worker in the pool.
worker< T > & operator=(worker< T > const &rhs)=delete
Deleted assignment operator.
worker(worker const &rhs)=delete
Deleted copy operator.
bool f_working
Whether this worker is currently working (true) or not (false).
T work_load_type
Type T of the worker.
fifo< T >::pointer_t f_out
The output fifo.
worker(std::string const &name, std::size_t position, typename fifo< T >::pointer_t in, typename fifo< T >::pointer_t out)
Initialize a worker thread.
bool is_working() const
Check whether this specific worker thread is busy.
std::size_t f_runs
The number of times this worker ran.
virtual void run()
Implement the worker loop.
virtual bool do_work()=0
Worker Function.
Exceptions for the thread environment.
Thread Runner and Managers.
Thread Runner and Managers.