librealtime  1.2
Extreamely easy to use realtime and policy thread
Public Member Functions | List of all members
RealtimeThread Class Reference

A real time thread. More...

#include <RealtimeThread.hpp>

Public Member Functions

double getPeriodAsSecond ()
 Get set period of this thread. More...
 
double getFrequency ()
 
bool isStarted ()
 Check if thread is already start. More...
 
template<class F , class... Args>
 RealtimeThread (double frequency, F &&func, Args &&... args)
 A constructor of real time thread class. More...
 
void start (bool shouldRealtime)
 This method allows to start thread loop. More...
 
void join ()
 Join the real time thread. More...
 
void detach ()
 Detach the real time thread. More...
 
bool joinable ()
 Check the thread can join or not. More...
 

Detailed Description

A real time thread.

This class make a periodic thread. the thread's loop is invoked with strict frequency. This thread class allows you to use like std::thread.

Constructor & Destructor Documentation

◆ RealtimeThread()

template<class F , class... Args>
RealtimeThread::RealtimeThread ( double  frequency,
F &&  func,
Args &&...  args 
)
inline

A constructor of real time thread class.

Parameters
frequencyFrequency of executing task of the thread [Hz].
funcFunction to execute in thread loop.
argsArguments of func. You can set not only one argument but also multiple arguments.

Member Function Documentation

◆ detach()

void RealtimeThread::detach ( )
inline

Detach the real time thread.

Just std::thread::detach() is called in detach() in this function.

◆ getPeriodAsSecond()

double RealtimeThread::getPeriodAsSecond ( )
inline

Get set period of this thread.

Returns
The period [sec]

\[ frac{1}{Hz} \]

◆ isStarted()

bool RealtimeThread::isStarted ( )
inline

Check if thread is already start.

If already started, return true. Othrewise return false.

◆ join()

void RealtimeThread::join ( )
inline

Join the real time thread.

Just std::thread::join() will be called inside RealtimeThread::join().

◆ joinable()

bool RealtimeThread::joinable ( )
inline

Check the thread can join or not.

Returns
If the thread can join, return true. Otherwise false.

◆ start()

void RealtimeThread::start ( bool  shouldRealtime)
inline

This method allows to start thread loop.

Parameters
shouldRealtimeIf true, this thread works as real time thread. otherwize false is set, this thread works as periodic std::thread.

Starting your thread with DEADLINE policy which is a real time thread controlling method.


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