Class real_time_tools::RealTimeThreadParameters

class real_time_tools::RealTimeThreadParameters

This class is a data structure allowing the user to share configurations among threads.

These parameter allows you to generate real threads in xenomai and rt_preempt. The same code is compatible with Mac and ubuntu but will run non-real time threads.

warning : initial version, copy pasted from : https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/application_base I did not study things now, so this likely needs improvement (alternative: https://rt.wiki.kernel.org/index.php/Threaded_RT-application_with_memory_locking_and_stack_handling_example) note: if failed as mlockall, run executable with sudo or be part of the real_time group or xenomai group.

Public Functions

inline RealTimeThreadParameters()

Construct a new RealTimeThreadParameters object.

inline ~RealTimeThreadParameters()

Destroy the RealTimeThreadParameters object.

Public Members

std::string keyword_

Used in xenomai to define the thread id.

int priority_

Defines the thread priority from 0 to 100.

int stack_size_

Define the stack size.

std::vector<int> cpu_id_

Define the cpu affinity.

Which means on which cpu(s) the thread is going to run

int dedicated_cpu_id_

indicate on which cpu the thread will run (xenomai only)

int delay_ns_

Todo:

Unknow Xenomai parameter

bool block_memory_

Defines if the thread should block the memory in a “page” or if several pages can be use.

Switching memory page is time consumming and a non real time operation.

int cpu_dma_latency_

Maximum desired latency of the CPU in microseconds.

Set to 0 to get best real-time performance. Set to any negative value if you do not want the thread to change the CPU latency.