Skip to content

SignalNotify

[Source]

Notifications for a signal.

interface ref SignalNotify

Public Functions

apply

[Source]

Called with the number of times the signal has fired since this was last called. Return false to stop listening for the signal.

Delivery batching differs by platform: on Linux, macOS, and the BSDs several firings that arrive close together can be reported in one call with count greater than one, while on Windows each firing is a separate call with a count of one.

fun ref apply(
  count: U32 val)
: Bool val

Parameters

  • count: U32 val

Returns


registration_failed

[Source]

Called when the handler's registration could not be completed. SignalSubscriberLimit is transient — a slot may open once another subscriber unsubscribes; SignalRegistrationRefused is permanent, so re-registering the same signal will fail again. The handler is then disposed — disposed follows once the runtime confirms it, and apply will not have run. If the handler was explicitly disposed before the failure was delivered, only disposed is called.

fun ref registration_failed(
  reason: SignalRegistrationError)
: None val

Parameters

Returns


disposed

[Source]

Called when the runtime has finished unregistering the handler, whichever way disposal began: explicitly via SignalHandler.dispose, when apply returned false, or when the registration could not be completed (preceded by registration_failed in that case). apply will never be called after this.

By the time this is called, the handler no longer affects signal delivery: if it was the signal's last subscriber, the signal's disposition from before it was first handled has been restored. For most signals that is the operating system default, so raising a terminating one from here ends the process; for a signal the runtime keeps ignored, such as SIGPIPE, it is SIG_IGN. A handler disposed while the runtime itself is shutting down may never receive this call.

fun ref disposed()
: None val

Returns