Maestro 0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Utils::WorkerThread< ThreadsPool, Job > Class Template Reference

WorkerThread class for a thread in a threads pool. More...

#include <WorkerThread.h>

Public Member Functions

 WorkerThread (ThreadsPool *threadsPool)
 Construct a new Worker Thread object.
 ~WorkerThread ()
 Destroy the Worker Thread object.
void Start ()
 Start the thread.
void Stop ()
 Stop the thread.
void SetStopUnlocked ()
 Set the stop flag without locking it.
void Join ()
 Join the thread.

Detailed Description

template<class ThreadsPool, class Job>
class Utils::WorkerThread< ThreadsPool, Job >

WorkerThread class for a thread in a threads pool.

A thread that is used in a threads pool, executing jobs.

Template Parameters
ThreadsPoolThe threads pool class.
JobThe job class/type.
See also
ThreadsPool

Definition at line 33 of file WorkerThread.h.

Constructor & Destructor Documentation

◆ WorkerThread()

template<class ThreadsPool, class Job>
Utils::WorkerThread< ThreadsPool, Job >::WorkerThread ( ThreadsPool * threadsPool)
inlineexplicit

Construct a new Worker Thread object.

Constructs a new Worker Thread object, associated with the given threads pool. The thread is started immediately.

Parameters
threadsPoolThe threads pool that this thread belongs to.

Definition at line 43 of file WorkerThread.h.

◆ ~WorkerThread()

template<class ThreadsPool, class Job>
Utils::WorkerThread< ThreadsPool, Job >::~WorkerThread ( )
inline

Destroy the Worker Thread object.

Destroys the Worker Thread object, stopping the thread if it is still running.

Definition at line 54 of file WorkerThread.h.

Member Function Documentation

◆ Join()

template<class ThreadsPool, class Job>
void Utils::WorkerThread< ThreadsPool, Job >::Join ( )
inline

Join the thread.

Joins the thread if it is joinable, waiting for it to finish.

Definition at line 102 of file WorkerThread.h.

◆ SetStopUnlocked()

template<class ThreadsPool, class Job>
void Utils::WorkerThread< ThreadsPool, Job >::SetStopUnlocked ( )
inline

Set the stop flag without locking it.

Sets the stop flag to true without locking the threads pool mutex.

Definition at line 95 of file WorkerThread.h.

◆ Start()

template<class ThreadsPool, class Job>
void Utils::WorkerThread< ThreadsPool, Job >::Start ( )
inline

Start the thread.

Starts the thread if not already started.

Definition at line 61 of file WorkerThread.h.

◆ Stop()

template<class ThreadsPool, class Job>
void Utils::WorkerThread< ThreadsPool, Job >::Stop ( )
inline

Stop the thread.

Stops the thread if it is running, and waits for it to finish.

Definition at line 77 of file WorkerThread.h.


The documentation for this class was generated from the following file: