[][src]Function interprocess::os::unix::signal::set_rthandler

pub fn set_rthandler(
    rtsignal: u32,
    handler: SignalHandler
) -> Result<(), SetHandlerError>

Installs the specified handler for the specified real-time signal, using the default values for the flags.

See HandlerOptions builder if you'd like to customize the flags.

Example

use interprocess::os::unix::signal::{self, SignalHandler};

let handler = unsafe {
    // Since signal handlers are restricted to a specific set of system calls, creating a
    // handler from an arbitrary function is unsafe because it might perform a system call
    // outside the list, and there's no real way to know that at compile time with the
    // current version of Rust. Since we're only using the write() system call here, this
    // is safe.
    SignalHandler::from_fn(|| {
        println!("You sent a real-time signal!");
    })
};

// Install our handler for the real-time signal 0.
signal::set_rthandler(0, handler);