# SignalNotify
<span class="source-link">[[Source]](src/signals/signal_notify.md#L-0-24)</span>

Notifications for a signal.


```pony
interface ref SignalNotify
```

## Public Functions

### apply
<span class="source-link">[[Source]](src/signals/signal_notify.md#L-0-28)</span>


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.


```pony
fun ref apply(
  count: U32 val)
: Bool val
```
#### Parameters

*   count: [U32](builtin-U32.md) val

#### Returns

* [Bool](builtin-Bool.md) val

---

### registration_failed
<span class="source-link">[[Source]](src/signals/signal_notify.md#L-0-40)</span>


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.


```pony
fun ref registration_failed(
  reason: SignalRegistrationError)
: None val
```
#### Parameters

*   reason: [SignalRegistrationError](signals-SignalRegistrationError.md)

#### Returns

* [None](builtin-None.md) val

---

### disposed
<span class="source-link">[[Source]](src/signals/signal_notify.md#L-0-52)</span>


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.


```pony
fun ref disposed()
: None val
```

#### Returns

* [None](builtin-None.md) val

---

