fn signal_enable(signal: c_int) -> io::Result<()> {
    if signal_hook_registry::FORBIDDEN.contains(&signal) {
        return Err(Error::new(
            ErrorKind::Other,
            format!("Refusing to register signal {}", signal),
        ));
    }

    let globals = globals();
    let siginfo = match globals.signals.get(signal as usize) {
        Some(slot) => slot,
        None => return Err(io::Error::new(io::ErrorKind::Other, "signal too large")),
    };
    let mut registered = Ok(());
    siginfo.init.call_once(|| {
        registered = unsafe {
            signal_hook_registry::register(signal, move || action(siginfo, &globals.sender))
                .map(|_| ())
        };
        if registered.is_ok() {
            siginfo.initialized.store(true, Ordering::Relaxed);
        }
    });
    registered?;
    // If the call_once failed, it won't be retried on the next attempt to register the signal. In
    // such case it is not run, registered is still `Ok(())`, initialized is still false.
    if siginfo.initialized.load(Ordering::Relaxed) {
        Ok(())
    } else {
        Err(Error::new(
            ErrorKind::Other,
            "Failed to register signal handler",
        ))
    }
}
/// Enable this module to receive signal notifications for the `signal`
/// provided.
///
/// This will register the signal handler if it hasn't already been registered,
/// returning any error along the way if that fails.
Enable this module to receive signal notifications for the `signal`
provided.

This will register the signal handler if it hasn't already been registered,
returning any error along the way if that fails.
Enable this module to receive signal notifications for the ` signal ` provided . This will register the signal handler if it hasn ' t already been registered returning any error along the way if that fails .
fn signal_enable(signal: c_int) -> io::Result<()> {
    if signal_hook_registry::FORBIDDEN.contains(&signal) {
        return Err(Error::new(
            ErrorKind::Other,
            format!("Refusing to register signal {}", signal),
        ));
    }
    let globals = globals();
    let siginfo = match globals.signals.get(signal as usize) {
        Some(slot) => slot,
        None => return Err(io::Error::new(io::ErrorKind::Other, "signal too large")),
    };
    let mut registered = Ok(());
    siginfo.init.call_once(|| {
        registered = unsafe {
            signal_hook_registry::register(signal, move || action(siginfo, &globals.sender))
                .map(|_| ())
        };
        if registered.is_ok() {
            siginfo.initialized.store(true, Ordering::Relaxed);
        }
    });
    registered?;
    // If the call_once failed, it won't be retried on the next attempt to register the signal. In
    // such case it is not run, registered is still `Ok(())`, initialized is still false.
    if siginfo.initialized.load(Ordering::Relaxed) {
        Ok(())
    } else {
        Err(Error::new(
            ErrorKind::Other,
            "Failed to register signal handler",
        ))
    }
}
fn signal_enable ( signal : c_int ) -> io :: Result < ( ) > { if signal_hook_registry :: FORBIDDEN . contains ( & signal ) { return Err ( Error :: new ( ErrorKind :: Other , format ! ( " " signal ) , ) ) ; } let globals = globals ( ) ; let siginfo = match globals . signals . get ( signal as usize ) { Some ( slot ) => slot , None => return Err ( io :: Error :: new ( io :: ErrorKind :: Other , " " ) ) , } ; let mut registered = Ok ( ( ) ) ; siginfo . init . call_once ( | | { registered = unsafe { signal_hook_registry :: register ( signal , move | | action ( siginfo , & globals . sender ) ) . map ( | _ | ( ) ) } ; if registered . is_ok ( ) { siginfo . initialized . store ( true , Ordering :: Relaxed ) ; } } ) ; registered ? ; // If the call_once failed, it won't be retried on the next attempt to register the signal. In // such case it is not run, registered is still `Ok(())`, initialized is still false. if siginfo . initialized . load ( Ordering :: Relaxed ) { Ok ( ( ) ) } else { Err ( Error :: new ( ErrorKind :: Other , " " , ) ) } }
Enable this module to receive signal notifications for the `signal`
provided.
Enable this module to receive signal notifications for the ` signal ` provided .
signal
c_int
signal
c_int