Loading...
Searching...
No Matches
stdex::watchdog< _Clock, _Duration > Class Template Reference

Triggers callback if not reset frequently enough. More...

`#include <stdex/watchdog.hpp>`

## Public Member Functions

| watchdog (_Duration timeout, std::function< void()> callback)
| Starts the watchdog.
| ~watchdog ()
| Stops the watchdog.
void | reset ()
| Resets the watchdog.

## Protected Member Functions

void | run ()

## Protected Attributes

size_t | m_phase
| A counter we are incrementing to keep the watchdog happy.
bool | m_quit
| Quit the watchdog.
_Duration | m_timeout
| How long the watchdog is waiting for a reset.
std::function< void()> | m_callback
| The function watchdog calls on timeout.
std::mutex | m_mutex
std::condition_variable | m_cv
std::thread | m_thread

## Detailed Description

template<class _Clock, class _Duration = typename _Clock::duration>
class stdex::watchdog< _Clock, _Duration >

Triggers callback if not reset frequently enough.

## Constructor & Destructor Documentation

## watchdog()

template<class _Clock , class _Duration = typename _Clock::duration>

stdex::watchdog< _Clock, _Duration >::watchdog | ( | _Duration | timeout,
|  | std::function< void()> | callback
| ) |  |

inline

Starts the watchdog.

Parameters

  [in] | timeout | How long the watchdog is waiting for a reset
  [in] | callback | The function watchdog calls on timeout

## Member Function Documentation

## reset()

template<class _Clock , class _Duration = typename _Clock::duration>

void stdex::watchdog< _Clock, _Duration >::reset | ( |  | ) |

inline

Resets the watchdog.

Must be called frequently enough not to timeout the watchdog

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

- include/stdex/watchdog.hpp