JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Debug/Watchdog.H>
Simple watchdog class.
This class will kill the current process if reset() is not called at least every timeout seconds. If timeout <= 0.0 then the watchdog is inactive (will never time out and kill the process). Note that to be as lightweight as possible, this class runs a background thread with a loop that iterates every timeout seconds, so the exact kill time is approximate.
Definition at line 29 of file Watchdog.H.
Public Member Functions | |
Watchdog (double timeout) | |
Constructor. | |
~Watchdog () | |
Virtual destructor for safe inheritance. | |
void | reset () |
Reset our internal timer. If this does not happen at least every timeout seconds, process is killed. | |
Protected Member Functions | |
void | run (double timeout) |
Protected Attributes | |
std::future< void > | itsRunFut |
std::atomic< bool > | itsReset = true |
std::atomic< bool > | itsRunning = false |
jevois::Watchdog::Watchdog | ( | double | timeout | ) |
Constructor.
Definition at line 27 of file Watchdog.C.
References jevois::async_little(), itsRunFut, itsRunning, and run().
jevois::Watchdog::~Watchdog | ( | ) |
Virtual destructor for safe inheritance.
Definition at line 37 of file Watchdog.C.
References JEVOIS_WAIT_GET_FUTURE.
void jevois::Watchdog::reset | ( | ) |
Reset our internal timer. If this does not happen at least every timeout seconds, process is killed.
Definition at line 47 of file Watchdog.C.
|
protected |
Definition at line 51 of file Watchdog.C.
References LERROR, and jevois::system().
Referenced by Watchdog().
|
protected |
Definition at line 44 of file Watchdog.H.
|
protected |
Definition at line 43 of file Watchdog.H.
Referenced by Watchdog().
|
protected |
Definition at line 45 of file Watchdog.H.
Referenced by Watchdog().