Struct nix::sys::signalfd::SignalFd
[−]
[src]
pub struct SignalFd(_);
A helper struct for creating, reading and closing a signalfd
instance.
Important: please read the module level documentation about signal discarding before using this struct!
Examples
use nix::sys::signalfd::*; let mut mask = SigSet::empty(); mask.add(signal::SIGUSR1).unwrap(); // Block the signal, otherwise the default handler will be invoked instead. mask.thread_block().unwrap(); // Signals are queued up on the file descriptor let mut sfd = SignalFd::with_flags(&mask, SFD_NONBLOCK).unwrap(); match sfd.read_signal() { // we caught a signal Ok(Some(sig)) => (), // there were no signals waiting (only happens when the SFD_NONBLOCK flag is set, // otherwise the read_signal call blocks) Ok(None) => (), Err(err) => (), // some error happend }