std.signal.Signal
Valuetype pub copy enum SignalA 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
Abort
Abort()The SIGABRT signal.
Child
Child()The SIGCHLD signal.
Continue
Continue()The SIGCONT signal.
FileSizeExceeded
FileSizeExceeded()The SIGXFSZ signal.
Hangup
Hangup()The SIGHUP signal.
Input
Input()The SIGTTIN signal.
Interrupt
Interrupt()The SIGINT signal.
Output
Output()The SIGTTOU signal.
Quit
Quit()The SIGQUIT signal.
Resize
Resize()The SIGWINCH signal.
Stop
Stop()The SIGTSTP signal.
Terminate
Terminate()The SIGTERM signal.
User1
User1()The SIGUSR1 signal.
User2
User2()The SIGUSR2 signal.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: ref Self) -> Bool {
!(self == other)
}fn pub !=(other: ref Self) -> BoolReturns true if self and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: Signal) -> Bool {
to_int == other.to_int
}fn pub ==(other: Signal) -> BoolReturns 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 -> SignalCreates a clone of self.
The returned value is an owned value that is the same type as the receiver
of this method. For example, cloning a ref Array[Int] results in a
Array[Int], not another ref Array[Int].
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_int(to_int)
}fn pub hash[H: mut + Hasher](hasher: mut H: mut)Writes the hash for self into the given Hasher.
to_int
Show source codeHide source code
fn pub to_int -> Int {
match self {
case Hangup -> libc.SIGHUP
case Interrupt -> libc.SIGINT
case Quit -> libc.SIGQUIT
case Abort -> libc.SIGABRT
case User1 -> libc.SIGUSR1
case User2 -> libc.SIGUSR2
case Terminate -> libc.SIGTERM
case Child -> libc.SIGCHLD
case Continue -> libc.SIGCONT
case Stop -> libc.SIGTSTP
case Input -> libc.SIGTTIN
case Output -> libc.SIGTTOU
case FileSizeExceeded -> libc.SIGXFSZ
case Resize -> libc.SIGWINCH
}
}fn pub to_int -> IntConverts self to a Int
wait
Show source codeHide source code
fn pub wait {
inko_signal_wait(_INKO.state, _INKO.process, to_int)
}fn pub waitWaits 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 for SignalEqual
impl Equal for SignalFormat
impl Format for SignalHash
impl Hash for SignalToInt
impl ToInt for Signal