JeVois  1.16
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
jevois::Watchdog Class Reference

#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.

Collaboration diagram for jevois::Watchdog:

Public Member Functions

 Watchdog (double timeout)
 Constructor. More...
 ~Watchdog ()
 Virtual destructor for safe inheritance. More...
void reset ()
 Reset our internal timer. If this does not happen at least every timeout seconds, process is killed. More...

Protected Member Functions

void run (double timeout)

Protected Attributes

std::future< void > itsRunFut
std::atomic< bool > itsReset = true
std::atomic< bool > itsRunning = false

Constructor & Destructor Documentation

◆ Watchdog()

jevois::Watchdog::Watchdog ( double  timeout)


Definition at line 27 of file Watchdog.C.

References jevois::async_little(), itsRunFut, itsRunning, and run().

◆ ~Watchdog()

jevois::Watchdog::~Watchdog ( )

Virtual destructor for safe inheritance.

Definition at line 37 of file Watchdog.C.


Member Function Documentation

◆ reset()

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.

◆ run()

void jevois::Watchdog::run ( double  timeout)

Definition at line 51 of file Watchdog.C.

References LERROR, jevois::system(), and jevois::to_string().

Referenced by Watchdog().

Member Data Documentation

◆ itsReset

std::atomic<bool> jevois::Watchdog::itsReset = true

Definition at line 44 of file Watchdog.H.

◆ itsRunFut

std::future<void> jevois::Watchdog::itsRunFut

Definition at line 43 of file Watchdog.H.

Referenced by Watchdog().

◆ itsRunning

std::atomic<bool> jevois::Watchdog::itsRunning = false

Definition at line 45 of file Watchdog.H.

Referenced by Watchdog().

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