source
inductive Std.Internal.IO.Async.Signal :
Type

Unix style signals for Unix and Windows. SIGKILL and SIGSTOP are missing because they cannot be caught. SIGPIPE is not present because the runtime ignores the signal.

- sighup : Signal

  Hangup detected on controlling terminal or death of controlling process. SIGHUP is not generated when terminal raw mode is enabled.

  On Windows:

  - SIGHUP is generated when the user closes the console window. The program is given ~10 seconds to cleanup before Windows unconditionally terminates it.
- sigint : Signal

  Interrupt program.

  - Normally delivered when the user presses CTRL+C. Not generated when terminal raw mode is enabled (like Unix).
- sigquit : Signal

  Quit program.

- sigtrap : Signal

  Trace/breakpoint trap.

- sigabrt : Signal

  Abort signal.

  Notes:

  - SIGABRT is not catchable if generated by certain runtime functions, such as abort or assertion failure.
  - On Windows, watchers can be created for SIGABRT, but they never receive the signal.
- sigemt : Signal

  Emulate instruction executed

- sigsys : Signal

  Bad system call.

- sigalrm : Signal

  Real-time timer expired.

- sigterm : Signal

  Termination signal.

  Notes:

  - On Windows, watchers can be created for SIGTERM, but they never receive the signal.
- sigurg : Signal

  Urgent condition on socket.

- sigtstp : Signal

  Stop typed at tty.

- sigcont : Signal

  Continue after stop.

- sigchld : Signal

  Child status has changed.

- sigttin : Signal

  Background read attempted from control terminal.

- sigttou : Signal

  Background write attempted to control terminal

- sigio : Signal

  I/O now possible.

- sigxcpu : Signal

  CPU time limit exceeded.

- sigxfsz : Signal

  File size limit exceeded.

- sigvtalrm : Signal

  Virtual alarm clock.

- sigprof : Signal

  Profiling timer expired.

- sigwinch : Signal

  Window size change.

  Notes:

  - SIGWINCH is raised whenever the runtime detects the console has been resized.
  - Under console emulators, or on 32-bit apps on 64-bit systems, SIGWINCH is emulated.
  - In these cases, signals may not be delivered timely.
- siginfo : Signal

  Status request from keyboard.

- sigusr1 : Signal

  User-defined signal 1.

- sigusr2 : Signal

  User-defined signal 2.

Instances For

source
def Std.Internal.IO.Async.instReprSignal.repr :
Signal → Nat → Format
Equations

- One or more equations did not get rendered due to their size.

Instances For

source
instance Std.Internal.IO.Async.instReprSignal :
Repr Signal
Equations

- Std.Internal.IO.Async.instReprSignal = { reprPrec := Std.Internal.IO.Async.instReprSignal.repr }

source
instance Std.Internal.IO.Async.instDecidableEqSignal :
DecidableEq Signal
Equations

- Std.Internal.IO.Async.instDecidableEqSignal x✝ y✝ = if h : x✝.ctorIdx = y✝.ctorIdx then isTrue ⋯ else isFalse ⋯

source
instance Std.Internal.IO.Async.instBEqSignal :
BEq Signal
Equations

- Std.Internal.IO.Async.instBEqSignal = { beq := Std.Internal.IO.Async.instBEqSignal.beq }

source
def Std.Internal.IO.Async.instBEqSignal.beq :
Signal → Signal → Bool
Equations

- Std.Internal.IO.Async.instBEqSignal.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)

Instances For

source
def Std.Internal.IO.Async.Signal.toInt32 :
Signal → Int32

Converts a `Signal` to its corresponding `Int32` value as defined in the libc `signal.h`.

Equations

- Std.Internal.IO.Async.Signal.sighup.toInt32 = 1
- Std.Internal.IO.Async.Signal.sigint.toInt32 = 2
- Std.Internal.IO.Async.Signal.sigquit.toInt32 = 3
- Std.Internal.IO.Async.Signal.sigtrap.toInt32 = 5
- Std.Internal.IO.Async.Signal.sigabrt.toInt32 = 6
- Std.Internal.IO.Async.Signal.sigemt.toInt32 = 7
- Std.Internal.IO.Async.Signal.sigsys.toInt32 = 12
- Std.Internal.IO.Async.Signal.sigalrm.toInt32 = 14
- Std.Internal.IO.Async.Signal.sigterm.toInt32 = 15
- Std.Internal.IO.Async.Signal.sigurg.toInt32 = 16
- Std.Internal.IO.Async.Signal.sigtstp.toInt32 = 18
- Std.Internal.IO.Async.Signal.sigcont.toInt32 = 19
- Std.Internal.IO.Async.Signal.sigchld.toInt32 = 20
- Std.Internal.IO.Async.Signal.sigttin.toInt32 = 21
- Std.Internal.IO.Async.Signal.sigttou.toInt32 = 22
- Std.Internal.IO.Async.Signal.sigio.toInt32 = 23
- Std.Internal.IO.Async.Signal.sigxcpu.toInt32 = 24
- Std.Internal.IO.Async.Signal.sigxfsz.toInt32 = 25
- Std.Internal.IO.Async.Signal.sigvtalrm.toInt32 = 26
- Std.Internal.IO.Async.Signal.sigprof.toInt32 = 27
- Std.Internal.IO.Async.Signal.sigwinch.toInt32 = 28
- Std.Internal.IO.Async.Signal.siginfo.toInt32 = 29
- Std.Internal.IO.Async.Signal.sigusr1.toInt32 = 30
- Std.Internal.IO.Async.Signal.sigusr2.toInt32 = 31

Instances For

source
structure Std.Internal.IO.Async.Signal.Waiter :
Type

`Signal.Waiter` can be used to handle a specific signal once.

- ofNative :: (

- native : UV.Signal

- )

Instances For

source
@[inline]
def Std.Internal.IO.Async.Signal.Waiter.mk (signum : Signal) (repeating : Bool) :
IO Waiter

Set up a `Signal.Waiter` that waits for the specified `signum`. This function only initializes but does not yet start listening for the signal.

Equations

- Std.Internal.IO.Async.Signal.Waiter.mk signum repeating = do let native ← Std.Internal.UV.Signal.mk signum.toInt32 repeating pure { native := native }

Instances For

source
@[inline]
def Std.Internal.IO.Async.Signal.Waiter.wait (s : Waiter) :
IO (AsyncTask Int)

If:

- `s` is not yet running start listening and return an `AsyncTask` that will resolve once the previously configured signal is received.
- `s` is already or not anymore running return the same `AsyncTask` as the first call to `wait`.

The resolved `AsyncTask` contains the signal number that was received.

Equations

- s.wait = do let promise ← s.native.next pure (Std.Internal.IO.Async.AsyncTask.ofPurePromise promise)

Instances For

source
@[inline]
def Std.Internal.IO.Async.Signal.Waiter.stop (s : Waiter) :
IO Unit

If:

- `s` is still running this stops `s` without resolving any remaining `AsyncTask`s that were created through `wait`. Note that if another `AsyncTask` is binding on any of these it is going hang forever without further intervention.
- `s` is not yet or not anymore running this is a no-op.

Equations

- s.stop = s.native.stop

Instances For

source
def Std.Internal.IO.Async.Signal.Waiter.selector (s : Waiter) :
Selector Unit

Create a `Selector` that resolves once `s` has received the signal. Note that calling this function does not start the signal waiter.

Equations

- One or more equations did not get rendered due to their size.

Instances For