API referencestd/signal

std/signal

Public declarations, types, methods, and source contracts for std/signal.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/signal"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
backend std/signal/native signal.dodo
error std/platform/error signal.dodo
net std/net signal.dodo
poll std/net/native signal.dodo

Signal

Enum · Source

Process-control requests delivered to a hosted program. Interrupt: SIGINT, or Ctrl-C in a Windows console. Terminate: SIGTERM, or a Windows console close, logoff or shutdown. Hangup: SIGHUP; POSIX only. Services conventionally reload on it. Break: Ctrl-Break in a Windows console; Windows only. The conventional counterpart of Hangup there. Selecting a signal the platform lacks is accepted; it never arrives.

pub enum Signal {
    Interrupt, Terminate, Hangup, Break
}

listen

Function · Source

Replaces the default action of the selected signals: instead of ending the process, each arrival is queued for next() in arrival order. Only one listener exists at a time; a second listen() fails with AlreadyExists.

pub fn listen(signals: &[Signal]) -> Listener!error.Error

Listener

Struct · Source

pub struct Listener {
    // Private implementation fields omitted.
}

Listener.register

Function · Source

The wake channel is readable while signals are pending. Register it with the other sources of an event loop, then call next() when it is ready.

pub fn register(&self, set: &mut poll.PollSet) -> usize!net.Error

Listener.next

Function · Source

The oldest pending signal, without waiting.

pub fn next(&mut self) -> Option<Signal>

Listener.wait

Function · Source

For programs without an event loop: the oldest pending signal, waiting up to milliseconds for one. none when the time passes first.

pub fn wait(&mut self, milliseconds: u32) -> Option<Signal>!error.Error

Listener.cancelled

Function · Source

Whether Interrupt or Terminate has arrived since listen(), whether or not next() has reported it. A listener is a cancellation source for APIs such as std/web/reactor serve_with.

pub fn cancelled(&self) -> bool

Listener.close

Function · Source

Restores the actions in place before listen(), as dropping the listener does. Pending signals are discarded; closing twice does nothing.

pub fn close(&mut self) -> void!error.Error

Search every guide, reference page, and API declaration.