MAX_LISTENERS
pub val MAX_LISTENERS = 32Number of listeners that can be registered at once.
pub val MAX_LISTENERS = 32Number of listeners that can be registered at once.
pub val MAX_SIGNALS = 128Highest signal number accepted by the numeric API.
pub enum Signal = { Hangup, Interrupt, Quit, IllegalInstruction, Trap, Abort, Break, BusError, FloatingPointException, Kill, User1, SegmentationViolation, User2, Pipe, Alarm, Terminate, Child, Continue, Stop, StopTerminal, BackgroundRead, BackgroundWrite, Urgent, CpuTimeExceeded, FileSizeExceeded, VirtualTimer, ProfilingTimer, WindowChange, Io, Power, System }Signals that can be intercepted.
Some entries only exist on certain platforms. number returns -1 and on reports SignalError.Unsupported when a signal is not available.
HangupInterruptQuitIllegalInstructionTrapAbortBreakBusErrorFloatingPointExceptionKillUser1SegmentationViolationUser2PipeAlarmTerminateChildContinueStopStopTerminalBackgroundReadBackgroundWriteUrgentCpuTimeExceededFileSizeExceededVirtualTimerProfilingTimerWindowChangeIoPowerSystempub enum SignalError = { InvalidSignal, Unsupported, CannotCatch, TableFull, InvalidListener, InstallFailed }Errors reported while installing or removing signal listeners.
InvalidSignalUnsupportedCannotCatchTableFullInvalidListenerInstallFailedfn listener_signal_slot(index: i64) mut ref i32 = trust { ... }fn listener_callback_slot(index: i64) mut ref usize = trust { ... }fn previous_slot(signum: i32) mut ref usize = trust { ... }fn installed_slot(signum: i32) mut ref usize = trust { ... }fn linux_number(sig: Signal) i32fn bsd_number(sig: Signal) i32fn windows_number(sig: Signal) i32pub fn number(sig: Signal) i32Return the platform signal number for sig, or -1 when the signal does not exist on the current platform.
pub fn name(sig: Signal) ref u8Return the conventional name of sig (for example "SIGINT").
fn dispatch(signum: i32) void = trust { ... }fn install(signum: i32) result[void, SignalError] = trust { ... }pub fn on_number(signum: i32, listener: fn(i32) void) result[void, SignalError] = trust { ... }Register listener for a numeric signal.
Multiple listeners may be registered for the same signal; they run in the order they were added. Returns an error when the signal is invalid, cannot be caught, or the listener table is full.
pub fn on(sig: Signal, listener: fn(i32) void) result[void, SignalError] = trust { ... }Register listener for sig.
pub fn off_number(signum: i32) void = trust { ... }Remove every listener registered for a numeric signal and restore the handler that was installed before the first listener was added.
pub fn off(sig: Signal) void = trust { ... }Remove every listener registered for sig.
pub fn clear() void = trust { ... }Remove every listener and restore all previous signal handlers.
pub fn raise_number(signum: i32) i32 = trust { ... }Send a numeric signal to the current process.
pub fn raise_signal(sig: Signal) i32 = trust { ... }Send sig to the current process.
fn test_listener(sig: i32) void