The CommunicationThread class is the abstract base class of all thread objects used in the communication module. More...
#include <communicationthread.h>
Public Member Functions | |
CommunicationThread () | |
CommunicationThread default constructor. More... | |
CommunicationThread (CommunicationThread &&other)=delete | |
CommunicationThread default Move initialization. More... | |
CommunicationThread (const CommunicationThread &other)=delete | |
CommunicationThread default Copy initialization. More... | |
CommunicationThread & | operator= (CommunicationThread &&other)=delete |
CommunicationThread default Move assignment. More... | |
CommunicationThread & | operator= (const CommunicationThread &other) |
CommunicationThread default Copy assignment. More... | |
void | sleep () |
Locks the current worker thread until wakeUp() is called. More... | |
virtual void | startThread ()=0 |
Start the threadded workload. More... | |
virtual void | stopThread ()=0 |
Stop the threadded workload. More... | |
void | wakeUp () |
Unlocks the current worker thread. More... | |
virtual void | workerFunction ()=0 |
Generic threadded worker function of this object. More... | |
Public Attributes | |
bool | active |
std::thread | worker |
Private Attributes | |
std::condition_variable | cond_var |
std::unique_lock< std::mutex > | lock |
std::mutex | m |
bool | notified |
The CommunicationThread class is the abstract base class of all thread objects used in the communication module.
Every object taking part in the communication module that has threaded functionality should implement this base class. It provides thread safety functionality and makes multithreading manageable and easy to use.
Definition at line 25 of file communicationthread.h.
|
inline |
CommunicationThread default constructor.
Definition at line 34 of file communicationthread.h.
|
delete |
CommunicationThread default Move initialization.
-> Move initialization is disabled.
|
delete |
CommunicationThread default Copy initialization.
-> Copy initialization is disabled.
|
delete |
CommunicationThread default Move assignment.
-> Move assignment is disabled.
|
inline |
CommunicationThread default Copy assignment.
Definition at line 65 of file communicationthread.h.
|
inline |
Locks the current worker thread until wakeUp() is called.
Definition at line 91 of file communicationthread.h.
|
pure virtual |
Start the threadded workload.
Implemented in SensorGroupThread, ThreadDispatcher, and ReadingThread.
|
pure virtual |
Stop the threadded workload.
Implemented in SensorGroupThread, ThreadDispatcher, and ReadingThread.
|
inline |
Unlocks the current worker thread.
Definition at line 102 of file communicationthread.h.
|
pure virtual |
Generic threadded worker function of this object.
Implemented in ThreadDispatcher, SensorGroupThread, and ReadingThread.
bool CommunicationThread::active |
Is this thread active?
Definition at line 28 of file communicationthread.h.
|
private |
Condition variable.
Definition at line 110 of file communicationthread.h.
|
private |
Lock object.
Definition at line 111 of file communicationthread.h.
|
mutableprivate |
Mutex object.
Definition at line 109 of file communicationthread.h.
|
private |
Has this thread been notified?
Definition at line 112 of file communicationthread.h.
std::thread CommunicationThread::worker |
Generic worker thread of this object.
Definition at line 29 of file communicationthread.h.