std.signal.Signal
Valuetype pub copy enum Signal
A Unix signal.
This type doesn't support all possible signals, instead it only supports the signals deemed useful and safe to use. Refer to the module documentation for more details.
Constructors
Hangup
Hangup()
The SIGHUP signal.
Interrupt
Interrupt()
The SIGINT signal.
Quit
Quit()
The SIGQUIT signal.
Abort
Abort()
The SIGABRT signal.
User1
User1()
The SIGUSR1 signal.
User2
User2()
The SIGUSR2 signal.
Terminate
Terminate()
The SIGTERM signal.
Child
Child()
The SIGCHLD signal.
Continue
Continue()
The SIGCONT signal.
Stop
Stop()
The SIGTSTP signal.
Input
Input()
The SIGTTIN signal.
Output
Output()
The SIGTTOU signal.
FileSizeExceeded
FileSizeExceeded()
The SIGXFSZ signal.
Resize
Resize()
The SIGWINCH signal.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}
fn pub !=(other: T) -> Bool
Returns true
if self
and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref Signal) -> Bool {
id == other.id
}
fn pub ==(other: Signal) -> Bool
Returns true
if self
and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
clone
Show source codeHide source code
fn pub clone -> Signal {
match self {
case Hangup -> Signal.Hangup
case Interrupt -> Signal.Interrupt
case Quit -> Signal.Quit
case Abort -> Signal.Abort
case User1 -> Signal.User1
case User2 -> Signal.User2
case Terminate -> Signal.Terminate
case Child -> Signal.Child
case Continue -> Signal.Continue
case Stop -> Signal.Stop
case Input -> Signal.Input
case Output -> Signal.Output
case FileSizeExceeded -> Signal.FileSizeExceeded
case Resize -> Signal.Resize
}
}
fn pub clone -> Signal
Creates a clone of self
.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
let name = match self {
case Hangup -> 'Hangup'
case Interrupt -> 'Interrupt'
case Quit -> 'Quit'
case Abort -> 'Abort'
case User1 -> 'User1'
case User2 -> 'User2'
case Terminate -> 'Terminate'
case Child -> 'Child'
case Continue -> 'Continue'
case Stop -> 'Stop'
case Input -> 'Input'
case Output -> 'Output'
case FileSizeExceeded -> 'FileSizeExceeded'
case Resize -> 'Resize'
}
formatter.tuple(name).finish
}
fn pub fmt(formatter: mut Formatter)
Formats self
in a human-readable format for debugging purposes.
hash
Show source codeHide source code
fn pub hash[H: mut + Hasher](hasher: mut H) {
hasher.write(id)
}
fn pub hash[H: mut + Hasher](hasher: mut H: mut)
Writes the hash for self
into the given Hasher
.
wait
Show source codeHide source code
fn pub wait {
inko_signal_wait(_INKO.state, _INKO.process, id)
}
fn pub wait
Waits for the signal to arrive before returning.
If the signal is sent before this call finishes setting up the signal handler, this method doesn't return until the next time the signal is received.
It's possible for multiple processes to call Signal.wait
using the same
signal. In this case receiving the signal results in all those
Signal.wait
calls returning. However, the order in which those calls
return is unspecified and shouldn't be relied upon.
No guarantees are made as to the time between receiving the signal and this method returning: it may be more or less instantly, or it could take some time.
When returning from this method and no other processes are waiting for the same signal to be received, the default signal handler is restored.
Examples
import std.signal (Signal)
Signal.User1.wait
Implemented traits
Clone
impl Clone[Signal] for Signal
Equal
impl Equal[Signal] for Signal
Format
impl Format for Signal
Hash
impl Hash for Signal