Triggers a callback after a given time elapses.
More...
#include <watchdog.hpp>
|
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) |
|
Definition at line 13 of file watchdog.hpp.
◆ watchdog() [1/2]
template<typename TimeUnits >
sysio::vm::watchdog::watchdog |
( |
const TimeUnits & | duration | ) |
|
|
inlineexplicit |
- Template Parameters
-
TimeUnits | must 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
-
TimeUnits | must be a chrono duration type |
- Precondition
- duration must be a non-negative value.
Definition at line 19 of file watchdog.hpp.
19: _duration(duration) {}
◆ 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: