Enum interprocess_docfix::os::windows::signal::SignalType
source · #[repr(i32)]#[non_exhaustive]pub enum SignalType {
KeyboardInterrupt,
IllegalInstruction,
Abort,
MathException,
SegmentationFault,
Termination,
}signals only.Expand description
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
KeyboardInterrupt
SIGINT – keyboard interrupt, usually sent by pressing Ctrl+C by the terminal. This signal is typically set to be ignored if the program runs an interactive interface: GUI/TUI, interactive shell (the Python shell, for example) or any other kind of interface which runs in a loop, as opposed to a command-line invocation of the program which reads its standard input or command-line arguments, performs a task and exits. If the interactive interface is running a lengthy operation, a good idea is to temporarily re-enable the signal and abort the lengthy operation if the signal is received, then disable it again.
Default handler: process termination.
IllegalInstruction
SIGILL – illegal or malformed instruction exception, generated by the CPU whenever such an instruction is executed. This signal normally should not be overriden or masked out, since it likely means that the executable file or the memory of the process has been corrupted and further execution is a risk of invoking negative consequences.
For reasons described above, this signal is considered unsafe – handling it requires using set_unsafe_handler. Signal hooks for this signal are also required to never return – those must be wrapped into a NoReturnSignalHook.
Default handler: process termination with a core dump.
Abort
SIGABRT – abnormal termination requested. This signal is typically invoked by the program itself, using std::process::abort or the equivalent C function; still, like any other signal, it can be sent from outside the process.
Default handler: process termination with a core dump.
MathException
SIGFPE – mathematical exception. This signal is generated whenever an undefined mathematical operation is performed – mainly integer division by zero.
Signal hooks for this signal are required to never return – those must be wrapped into a NoReturnSignalHook.
Default handler: process termination with a core dump.
SegmentationFault
SIGSEGV – invaid memory access. This signal is issued by the OS whenever the program tries to access an invalid memory location, such as the NULL pointer or simply an address outside the user-mode address space as established by the OS. The only case when this signal can be received by a Rust program is if memory unsafety occurs due to misuse of unsafe code. As such, it should normally not be masked out or handled, as it likely indicates a critical bug (soundness hole), executable file corruption or process memory corruption.
For reasons described above, this signal is considered unsafe – handling it requires using set_unsafe_handler. Signal hooks for this signal are also required to never return – those must be wrapped into a NoReturnSignalHook.
Default handler: process termination with a core dump.
Termination
SIGTERM – request for termination. This signal can only be sent using the usual signal sending procedures. Unlike KeyboardInterrupt, this signal is not a request to break out of a lengthy operation, but rather to close the program as a whole. Signal handlers for this signal are expected to perform minimal cleanup and quick state save procedures and then exit.
Default handler: process termination.
Implementations§
source§impl SignalType
impl SignalType
sourcepub const fn requires_diverging_hook(self) -> bool
pub const fn requires_diverging_hook(self) -> bool
Returns true if the value is a signal which requires its custom handler functions to never return, false otherwise.
Trait Implementations§
source§impl Clone for SignalType
impl Clone for SignalType
source§fn clone(&self) -> SignalType
fn clone(&self) -> SignalType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SignalType
impl Debug for SignalType
source§impl From<SignalType> for i32
impl From<SignalType> for i32
source§fn from(op: SignalType) -> Self
fn from(op: SignalType) -> Self
source§impl From<SignalType> for u32
impl From<SignalType> for u32
source§fn from(op: SignalType) -> Self
fn from(op: SignalType) -> Self
source§impl Hash for SignalType
impl Hash for SignalType
source§impl PartialEq<SignalType> for SignalType
impl PartialEq<SignalType> for SignalType
source§fn eq(&self, other: &SignalType) -> bool
fn eq(&self, other: &SignalType) -> bool
self and other values to be equal, and is used
by ==.