use std::sync::atomic::{AtomicBool, Ordering};
static RESIZED: AtomicBool = AtomicBool::new(false);
extern "C" fn on_sigwinch(_sig: libc::c_int) {
RESIZED.store(true, Ordering::SeqCst);
}
pub fn install() -> bool {
let r = unsafe {
libc::signal(
libc::SIGWINCH,
on_sigwinch as *const () as libc::sighandler_t,
)
};
r != libc::SIG_ERR
}
pub fn take() -> bool {
RESIZED.swap(false, Ordering::SeqCst)
}