Public Member Functions | Public Attributes | Private Attributes | List of all members
CommunicationThread Class Referenceabstract

The CommunicationThread class is the abstract base class of all thread objects used in the communication module. More...

#include <communicationthread.h>

Inheritance diagram for CommunicationThread:
Inheritance graph
[legend]

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...
 
CommunicationThreadoperator= (CommunicationThread &&other)=delete
 CommunicationThread default Move assignment. More...
 
CommunicationThreadoperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

CommunicationThread::CommunicationThread ( )
inline

CommunicationThread default constructor.

Definition at line 34 of file communicationthread.h.

CommunicationThread::CommunicationThread ( CommunicationThread &&  other)
delete

CommunicationThread default Move initialization.

-> Move initialization is disabled.

CommunicationThread::CommunicationThread ( const CommunicationThread other)
delete

CommunicationThread default Copy initialization.

-> Copy initialization is disabled.

Member Function Documentation

CommunicationThread& CommunicationThread::operator= ( CommunicationThread &&  other)
delete

CommunicationThread default Move assignment.

-> Move assignment is disabled.

CommunicationThread& CommunicationThread::operator= ( const CommunicationThread other)
inline

CommunicationThread default Copy assignment.

Definition at line 65 of file communicationthread.h.

void CommunicationThread::sleep ( )
inline

Locks the current worker thread until wakeUp() is called.

Definition at line 91 of file communicationthread.h.

virtual void CommunicationThread::startThread ( )
pure virtual

Start the threadded workload.

Implemented in SensorGroupThread, ThreadDispatcher, and ReadingThread.

virtual void CommunicationThread::stopThread ( )
pure virtual

Stop the threadded workload.

Implemented in SensorGroupThread, ThreadDispatcher, and ReadingThread.

void CommunicationThread::wakeUp ( )
inline

Unlocks the current worker thread.

Definition at line 102 of file communicationthread.h.

virtual void CommunicationThread::workerFunction ( )
pure virtual

Generic threadded worker function of this object.

Implemented in ThreadDispatcher, SensorGroupThread, and ReadingThread.

Member Data Documentation

bool CommunicationThread::active

Is this thread active?

Definition at line 28 of file communicationthread.h.

std::condition_variable CommunicationThread::cond_var
private

Condition variable.

Definition at line 110 of file communicationthread.h.

std::unique_lock<std::mutex> CommunicationThread::lock
private

Lock object.

Definition at line 111 of file communicationthread.h.

std::mutex CommunicationThread::m
mutableprivate

Mutex object.

Definition at line 109 of file communicationthread.h.

bool CommunicationThread::notified
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.


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


pses_ucbridge
Author(s): Sebastian Ehmes
autogenerated on Sat Oct 28 2017 19:16:13