use std::cell::RefCell;
thread_local! {
static EXIT_EVENTS: RefCell<Vec<(i16, u32)>> = const { RefCell::new(Vec::new()) };
}
pub(crate) fn record_event(filter: i16, fflags: u32) {
EXIT_EVENTS.with(|e| e.borrow_mut().push((filter, fflags)));
}
pub(crate) fn take_events() -> Vec<(i16, u32)> {
EXIT_EVENTS.with(|e| std::mem::take(&mut *e.borrow_mut()))
}
pub(crate) fn send_signal(pid: u32, signal: libc::c_int) {
let rc = unsafe { libc::kill(pid as libc::pid_t, signal) };
assert_eq!(rc, 0, "kill({pid}, {signal}): {}", std::io::Error::last_os_error());
}