Go to the documentation of this file.
5 #ifndef IFW_CCF_MPTK_THREAD_HPP_
6 #define IFW_CCF_MPTK_THREAD_HPP_
13 #include <rad/logger.hpp>
14 #include <rad/exceptions.hpp>
46 Thread(
const std::string& thread_id,
48 const double period = 0.1);
57 std::string
GetId()
const;
106 std::string m_thread_id;
110 uint64_t m_iteration_count;
112 double m_previous_start_time;
113 double m_next_execution;
114 bool m_thread_terminated;
115 bool m_gen_statistics;
116 struct sched_param m_sched_par;
118 std::unique_ptr<std::thread> m_sys_thread;
120 std::recursive_mutex m_thr_mutex;
125 #endif // IFW_CCF_MPTK_THREAD_HPP_
bool GetExecFlag()
Check the Thread Execution Flag. The Thread Execution Flag shall be called regularly in the thread,...
Definition: thread.cpp:185
Definition: manager.hpp:15
ThreadExecControl
Thread execution control/status.
Definition: thread.hpp:34
std::string ToString() const
Generate ASCII output providing a status of the object.
@ THREAD_EXEC_STOPPED
Definition: thread.hpp:35
IFW CTD Multiprocessing Toolkit Thread base class.
Definition: thread.hpp:29
virtual void UserLogic()
User provided business logic. The UserLogic method need not execute an internal loop....
Definition: thread.cpp:130
std::string GetId() const
Return the thread ID.
Definition: thread.cpp:72
void Pause()
Pause the thread execution.
Definition: thread.cpp:170
virtual ~Thread()
Definition: thread.cpp:67
void Continue()
Continue a paused thread execution.
Definition: thread.cpp:177
MessageBus & MsgBus()
Get acces to the MessageBus associated with this thread object.
Definition: thread.cpp:211
void SetPriority(const int prio=-1)
If invoked, it will run the thread in real-time mode with the given priority [0; 99].
Definition: thread.cpp:118
IFW CTD Multiprocessing Toolkit Message Bus.
Definition: messageBus.hpp:30
@ THREAD_EXEC_RUNNING
Definition: thread.hpp:36
void Run()
Method to invoke the user provided business logic of the thread. The method executes internally a loo...
Definition: thread.cpp:77
double GetDrift() const
Definition: thread.cpp:157
static std::map< std::string, Thread * > s_thread_registry
Definition: thread.hpp:31
void Stop()
Stop the thread execution.
Definition: thread.cpp:162
Thread(const std::string &thread_id, MessageBus &message_bus, const double period=0.1)
Constructor method, setting up the internal members.
Definition: thread.cpp:41
void SleepUntil(struct timespec *ts, int delay)
Adds "delay" nanoseconds to timespecs and sleeps until that time.
Definition: thread.cpp:17
bool Terminated()
Returns true if thread no longer running.
Definition: thread.cpp:216
void Start()
Start the thread execution.
Definition: thread.cpp:141
const std::string THREAD_REGISTRY
Definition: thread.hpp:19
@ THREAD_EXEC_PAUSED
Definition: thread.hpp:37