Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm::watchdog Class Reference

Triggers a callback after a given time elapses. More...

#include <watchdog.hpp>

Public Member Functions

template<typename TimeUnits >
 watchdog (const TimeUnits &duration)
 
template<typename F >
guard scoped_run (F &&callback)
 
template<typename TimeUnits >
 watchdog (const TimeUnits &duration)
 
template<typename F >
guard scoped_run (F &&callback)
 

Detailed Description

Definition at line 13 of file watchdog.hpp.

Constructor & Destructor Documentation

◆ watchdog() [1/2]

template<typename TimeUnits >
sysio::vm::watchdog::watchdog ( const TimeUnits & duration)
inlineexplicit
Template Parameters
TimeUnitsmust be a chrono duration type
Precondition
duration must be a non-negative value.

Definition at line 19 of file watchdog.hpp.

19: _duration(duration) {}

◆ watchdog() [2/2]

template<typename TimeUnits >
sysio::vm::watchdog::watchdog ( const TimeUnits & duration)
inlineexplicit
Template Parameters
TimeUnitsmust be a chrono duration type
Precondition
duration must be a non-negative value.

Definition at line 19 of file watchdog.hpp.

19: _duration(duration) {}

Member Function Documentation

◆ scoped_run() [1/2]

template<typename F >
guard sysio::vm::watchdog::scoped_run ( F && callback)
inlinenodiscard

Starts the timer. If the timer expires during the lifetime of the returned object, the callback will be executed. The callback is executed asynchronously. If invoking the callback throws an exception, terminate will be called.

Definition at line 26 of file watchdog.hpp.

26 {
27 return guard(_duration, static_cast<F&&>(callback));
28 }

◆ scoped_run() [2/2]

template<typename F >
guard sysio::vm::watchdog::scoped_run ( F && callback)
inlinenodiscard

Starts the timer. If the timer expires during the lifetime of the returned object, the callback will be executed. The callback is executed asynchronously. If invoking the callback throws an exception, terminate will be called.

Definition at line 26 of file watchdog.hpp.

26 {
27 return guard(_duration, static_cast<F&&>(callback));
28 }

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