#include <TimingTools.hpp>
Public Member Functions | |
void | reset () |
watchdog (const boost::function< void(void)> &func, size_t timeout_ms=500, size_t loop_ms=100) | |
~watchdog () | |
Private Member Functions | |
void | run () |
Private Attributes | |
boost::mutex | cntMutex |
volatile size_t | counter |
boost::function< void(void)> | func |
size_t | loop_ms |
boost::thread | runner |
size_t | timeout_ms |
This structure is used to perform watchdog operations. The watchdog timer triggers the user defined function.
Definition at line 143 of file TimingTools.hpp.
labust::tools::watchdog::watchdog | ( | const boost::function< void(void)> & | func, |
size_t | timeout_ms = 500 , |
||
size_t | loop_ms = 100 |
||
) | [inline] |
Main constructor. Takes the user desired function and timing.
func | The user defined functor to be called when the watchdog triggers. |
timeout_ms | The timeout time after which to trigger. |
loop_ms | The loop time of the watchdog function. |
Definition at line 152 of file TimingTools.hpp.
labust::tools::watchdog::~watchdog | ( | ) | [inline] |
Generic destructor.
Definition at line 161 of file TimingTools.hpp.
void labust::tools::watchdog::reset | ( | ) | [inline] |
The method resets the watchdog counter.
Definition at line 170 of file TimingTools.hpp.
void labust::tools::watchdog::run | ( | ) | [inline, private] |
The method performs the watchdog operation.
Definition at line 176 of file TimingTools.hpp.
boost::mutex labust::tools::watchdog::cntMutex [private] |
The protector mutex for access synchonization to the counter variable.
Definition at line 210 of file TimingTools.hpp.
volatile size_t labust::tools::watchdog::counter [private] |
The counter variable.
Definition at line 198 of file TimingTools.hpp.
boost::function<void (void)> labust::tools::watchdog::func [private] |
The user functor.
Definition at line 189 of file TimingTools.hpp.
size_t labust::tools::watchdog::loop_ms [private] |
Definition at line 202 of file TimingTools.hpp.
boost::thread labust::tools::watchdog::runner [private] |
The watchdog execution thread.
Definition at line 206 of file TimingTools.hpp.
size_t labust::tools::watchdog::timeout_ms [private] |
The watchdog timeout and loop time.
Definition at line 202 of file TimingTools.hpp.