DeterministicESPAsyncWebServer v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
failsafe.h File Reference

Software watchdog: deadlock detection + fail-safe safe-state (DETWS_ENABLE_FAILSAFE). More...

#include "ServerConfig.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Detailed Description

Software watchdog: deadlock detection + fail-safe safe-state (DETWS_ENABLE_FAILSAFE).

A fixed registry of "lifelines" - a task, worker, or control loop that must check in (detws_failsafe_feed) at least every deadline_ms. If one stops checking in (a hang, a deadlock, a wedged loop), detws_failsafe_check() detects it and fires a breach callback exactly once per stuck episode, so the app can drive its outputs to a known-safe state (motors off, valves closed), log, and optionally reset. It complements the hardware task watchdog: this one is app-defined, per-lifeline, and knows which subsystem wedged.

Zero heap (a static registry), no stdlib. The overdue test is a wrap-safe unsigned time delta, so it is correct across a millis() rollover. The evaluation core takes an explicit now, so it is fully host-testable with a synthetic clock; the no-now wrappers read the pluggable detws_millis().

Definition in file failsafe.h.