Crate signal_handler
source ·Expand description
Signal handlers for CPU exceptions/errors, like POSIX-style signals, but safer and Rusty.
Instead of directly supporting POSIX signals like SIGSEGV, SIGILL, etc, this crate only supports a few categories of signals that represent a CPU/machine exception, e.g., divide errors, page faults, illegal instructions, etc.
Each task can register up to one signal handler per signal kind. If/when that exception occurs, the full context of that exception is provided as an argument to the registered signal handler.
Signal handlers can only be invoked once. If an exception occurs, it is up to the task logic to re-register that signal handler again.
Structs
- An error type indicating a handler had already been registered for a particular
Signal
. - Information that is passed to a registered
SignalHandler
about an exception that occurred during execution.
Enums
- Possible error codes that may be provided by the CPU during an exception.
- The possible signals that may occur due to CPU exceptions.
Functions
- Register a
SignalHandler
callback function for the current task. - Take the
SignalHandler
registered for the givensignal
for the current task.
Trait Aliases
- A signal handler is a callback function that will be invoked when a task’s execution causes an illegal error or exception.