Function is_ctrlc_received

Source
pub fn is_ctrlc_received() -> bool
Expand description

Checks whether Ctrl-C (SIGINT) has been received.

Returns true if a SIGINT signal (typically from Ctrl-C) has been delivered since init_ctrlc() was called.

Once set, the flag remains true for the lifetime of the process.

This function is safe to call from any thread at any time after initialization.

§Examples

ctrlc_tiny::init_ctrlc()?;
loop {
    if ctrlc_tiny::is_ctrlc_received() {
        println!("Received Ctrl-C");
        break;
    }
}