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

A real time thread. More...

#include <PolicyThread.hpp>

Public Member Functions

bool isStarted ()
 Check if thread is already start. More...
 
template<class F , class... Args>
 PolicyThread (F &&func, Args &&... args)
 A constructor of real time thread class. More...
 
void start (int priority=0)
 Start thread with the priority and FIFO policy. More...
 
int getPriority ()
 Get Priority from running thread. 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

◆ PolicyThread()

template<class F , class... Args>
PolicyThread::PolicyThread ( F &&  func,
Args &&...  args 
)
inline

A constructor of real time thread class.

Parameters
frequencyFrequency of executing task of the thread.
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 PolicyThread::detach ( )
inline

Detach the real time thread.

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

◆ getPriority()

int PolicyThread::getPriority ( )
inline

Get Priority from running thread.

Returns
A priority of the thread.

◆ isStarted()

bool PolicyThread::isStarted ( )
inline

Check if thread is already start.

If already started, return true. Othrewise return false.

◆ join()

void PolicyThread::join ( )
inline

Join the real time thread.

Only std::thread::join() will be called in this function.

◆ joinable()

bool PolicyThread::joinable ( )
inline

Check the thread can join or not.

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

◆ start()

void PolicyThread::start ( int  priority = 0)
inline

Start thread with the priority and FIFO policy.

Parameters
priorityA priority. Set higher number, Get Higher priority. Default priority is 0.

Starting your thread with FIFO policy with the priority.

  • Maximum priority = 99
  • Minimum priority = 0

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