Expand description
Process-global interrupt handling
This module contains facilities to globally request an interrupt, which will cause supporting computations to
abort once it is observed.
Such checks for interrupts are provided in custom implementations of various traits to transparently add interrupt
support to methods who wouldn’t otherwise by injecting it. see Read.
Structs§
- Deregister
interrupt - A type to help deregistering hooks registered with
init_handler; - Iter
- A wrapper for an inner iterator which will check for interruptions on each iteration.
- Read
- A wrapper for implementers of
std::io::Readorstd::io::BufReadwith interrupt support.
Statics§
- IS_
INTERRUPTED - The flag behind all utility functions in this module.
Functions§
- init_
handler ⚠interrupt - Initialize a signal handler to listen to SIGINT and SIGTERM and trigger our
trigger()that way. Also triggerinterrupt()which promises to never use a Mutex, allocate or deallocate, or do anything else that’s blocking. Usegrace_countto determine how often the termination signal can be received before it’s terminal, e.g. 1 would only terminate the application the second time the signal is received. Note that only thegrace_countandinterruptof the first call are effective, all others will be ignored. - is_
triggered - Returns true if an interrupt is requested.
- reset
- Sets the interrupt request to false, thus allowing those checking for
is_triggered()to proceed. - trigger
- Trigger an interrupt, signalling to those checking for
is_triggered()to stop what they are doing.