toomuch 0.0.3

A GNU timeout-compatible command wrapper with interactive suspend/resume support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::sync::atomic::{AtomicBool, Ordering};

static WINCH: AtomicBool = AtomicBool::new(false);

pub fn install_sigwinch() {
    unsafe {
        libc::signal(libc::SIGWINCH, handle_sigwinch as usize);
    }
}

extern "C" fn handle_sigwinch(_: i32) {
    WINCH.store(true, Ordering::SeqCst);
}

pub fn winch_triggered() -> bool {
    WINCH.swap(false, Ordering::SeqCst)
}