RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::Watchdog Class Reference

Detects when the runtime stops ticking because a coroutine is blocking the loop. More...

#include <Watchdog.hpp>

Public Member Functions

 Watchdog (Duration timeout)
 Watchdog (const Watchdog &)=delete
Watchdog & operator= (const Watchdog &)=delete
void tickStarted () noexcept
 Called by the runtime at the start of every tick.
void resuming (std::source_location location) noexcept
 Called by the runtime just before it resumes a coroutine that was waiting at location.
bool stalled (Time now)
 Polled from the watching task: true once no tick has started for timeout.
std::source_location lastResumed () const noexcept
 Where the coroutine most recently resumed was waiting: the code after it is what's blocking.

Detailed Description

Detects when the runtime stops ticking because a coroutine is blocking the loop.

The runtime reports to it (tickStarted, resuming) from its own task; another, higher-priority task polls stalled and lastResumed. This class holds the only state shared between the two tasks. Nothing counts as a stall before the first tick, and a zero timeout disables it.

Constructor & Destructor Documentation

◆ Watchdog() [1/2]

rz::Watchdog::Watchdog ( Duration timeout)
inlineexplicit

◆ Watchdog() [2/2]

rz::Watchdog::Watchdog ( const Watchdog & )
delete

Member Function Documentation

◆ lastResumed()

std::source_location rz::Watchdog::lastResumed ( ) const
inlinenodiscardnoexcept

Where the coroutine most recently resumed was waiting: the code after it is what's blocking.

◆ operator=()

Watchdog & rz::Watchdog::operator= ( const Watchdog & )
delete

◆ resuming()

void rz::Watchdog::resuming ( std::source_location location)
inlinenoexcept

Called by the runtime just before it resumes a coroutine that was waiting at location.

◆ stalled()

bool rz::Watchdog::stalled ( Time now)
inlinenodiscard

Polled from the watching task: true once no tick has started for timeout.

◆ tickStarted()

void rz::Watchdog::tickStarted ( )
inlinenoexcept

Called by the runtime at the start of every tick.


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