Skip to content

SignalHandler

[Source]

Listen for a specific signal.

Multiple SignalHandlers can be registered for the same signal — up to 16 per signal number. All registered handlers will be notified when the signal is received, in no particular order. If a handler cannot be registered (the 16-subscriber limit is reached, or the runtime fails to register with the operating system), its notify's registration_failed is called with the reason and the handler is automatically disposed; apply will not have run.

If the wait parameter is true, the program will not terminate until the SignalHandler's dispose method is called or the SignalNotify returns false after handling the signal. Disposing a SignalHandler unsubscribes it from the signal and is required to allow the runtime to garbage collect the handler.

actor tag SignalHandler is
  AsioEventNotify tag

Implements


Constructors

create

[Source]

Create a signal handler for a validated signal number.

new tag create(
  auth: SignalAuth val,
  notify: SignalNotify iso,
  sig: HandleableSignal,
  wait: Bool val = false)
: SignalHandler tag^

Parameters

Returns


Public Behaviours

raise

[Source]

Raise the signal, process-wide: every currently subscribed handler for this signal is notified, not just this one. If no handler is subscribed when the signal is delivered — every handler was disposed, or none ever registered — the signal's current disposition applies: the operating system default for most signals, which ends the process for a terminating one, but SIG_IGN for a signal the runtime keeps ignored such as SIGPIPE, which does nothing.

be raise(
  auth: SignalAuth val)

Parameters


dispose

[Source]

Dispose of the signal handler, unsubscribing from the signal.

be dispose(
  auth: SignalAuth val)

Parameters