pub fn reset_ctrlc_received()Expand description
Resets the internal Ctrl-C received flag to false.
This can be useful if you want to detect multiple Ctrl-C presses independently (e.g. “exit on second Ctrl-C”).
§Safety
Internally, this clears a sig_atomic_t flag that may be concurrently
modified by the signal handler. This is safe but may cause a signal
received during the reset to be missed.
§Examples
ctrlc_tiny::init_ctrlc_with_print("Ctrl+C pressed\n")?;
let mut count = 0;
loop {
if ctrlc_tiny::is_ctrlc_received() {
ctrlc_tiny::reset_ctrlc_received();
count += 1;
if count == 2 {
break;
}
}
}