Expand description
OS-thread watchdog for stuck task detection with RAII guards.
nano-watchdog runs on a dedicated OS thread — not Tokio — so it
can detect deadlocks even when the async runtime is frozen.
§Quick Start
use nano_watchdog::{TaskTracker, WatchdogConfig, start_watchdog};
// Create a tracker (typically stored in a static)
let tracker = Box::leak(Box::new(TaskTracker::new()));
// Start the watchdog thread
start_watchdog(tracker, WatchdogConfig::default(), None);
// Track tasks with RAII guards
let guard = tracker.track("processing request");
guard.set_phase("parsing");
// ... do work ...
guard.set_phase("responding");
// guard dropped — task automatically unregisteredStructs§
- Stuck
Task Info - Information about a task that has exceeded the stuck threshold.
- Task
Guard - RAII guard that tracks a task’s lifetime.
- Task
Tracker - Tracks active tasks for deadlock detection.
- Watchdog
Config - Configuration for the watchdog loop.
Functions§
- start_
watchdog - Start the watchdog on a dedicated OS thread.
Type Aliases§
- OnStuck
Callback - Callback type for stuck task notifications.