# SignalHandler
<span class="source-link">[[Source]](src/signals/signal_handler.md#L-0-10)</span>

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.


```pony
actor tag SignalHandler is
  AsioEventNotify tag
```

#### Implements

* [AsioEventNotify](builtin-AsioEventNotify.md) tag

---

## Constructors

### create
<span class="source-link">[[Source]](src/signals/signal_handler.md#L-0-32)</span>


Create a signal handler for a validated signal number.


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

*   auth: [SignalAuth](signals-SignalAuth.md) val
*   notify: [SignalNotify](signals-SignalNotify.md) iso
*   sig: [HandleableSignal](signals-HandleableSignal.md)
*   wait: [Bool](builtin-Bool.md) val = false

#### Returns

* [SignalHandler](signals-SignalHandler.md) tag^

---

## Public Behaviours

### raise
<span class="source-link">[[Source]](src/signals/signal_handler.md#L-0-46)</span>


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.


```pony
be raise(
  auth: SignalAuth val)
```
#### Parameters

*   auth: [SignalAuth](signals-SignalAuth.md) val

---

### dispose
<span class="source-link">[[Source]](src/signals/signal_handler.md#L-0-58)</span>


Dispose of the signal handler, unsubscribing from the signal.


```pony
be dispose(
  auth: SignalAuth val)
```
#### Parameters

*   auth: [SignalAuth](signals-SignalAuth.md) val

---

