pub struct WatchdogConfig {
pub threshold: Duration,
pub heartbeat_interval: Duration,
pub poll_interval: Duration,
pub on_stall: Option<StallCallback>,
pub emit_event: bool,
}Fields§
§threshold: DurationA heartbeat older than this is a stall.
heartbeat_interval: DurationHow often the main thread is pinged. The floor is 10 ms.
poll_interval: DurationThe shortest the watchdog thread waits between two looks at the heartbeat, which bounds how late a stall is reported past the threshold. Default 250 ms; the floor is 10 ms. The thread no longer polls at this rate: idle it sleeps until the last beat plus the threshold can have passed, so a larger value only widens the allowed lateness and a smaller one only shrinks it.
on_stall: Option<StallCallback>Called once per stall episode with the stall duration (see StallReport::stalled_ms), on the
watchdog thread. A host can use it to write a hang dump. It runs before the rightkit-shell://stall
event.
emit_event: boolAlso emit the rightkit-shell://stall event to the webview. Default true.
Hazard: the event is emitted from the watchdog thread through the AppHandle, and that
thread exists to observe an app that may be deadlocked. Emitting takes app-side locks, so a
deadlock in the app can stop the watchdog thread too, at the moment its report matters most.
Set false for callback-only mode: the poll thread then touches only std atomics and
on_stall (it is not even given an AppHandle). A failed emit never ends the loop in either
mode; it is counted in WatchdogStatus::emit_failures.