Crates.io | rt-watchdog |
lib.rs | rt-watchdog |
version | 0.1.0 |
source | src |
created_at | 2023-12-29 17:56:32.375336 |
updated_at | 2023-12-29 17:56:32.375336 |
description | Real-time userspace watchdog for Rust. |
homepage | |
repository | |
max_upload_size | |
id | 1083519 |
size | 26,376 |
Real-time userspace watchdog for Rust. Currently supported platforms are x86-64 Linux and AArch64 Linux.
SCHED_DEADLINE
scheduler, guaranteeing the
highest real-time priority.mlock
-ed.If a tick is missed, the current process is immediately aborted.
An option is provided to fall back to a simple, non-realtime implementation on unsupported platforms.
use std::sync::atomic::Ordering;
use std::time::Duration;
let ctx = rt_watchdog::start_watchdog(
rt_watchdog::Strategy::RealtimeOrFallback,
Duration::from_millis(100),
);
loop {
ctx.counter.fetch_add(1, Ordering::SeqCst);
std::thread::sleep(Duration::from_millis(90));
}
The process must have the CAP_SYS_NICE
capability to use the deadline
scheduler. Add the capability to an executable with:
sudo setcap "cap_sys_nice=eip" ./myapp