Function signal

fn signal(kind: SignalKind) -> io::Result<Signal>

Creates a new listener which will receive notifications when the current process receives the specified signal kind.

This function will create a new stream which binds to the default reactor. The Signal stream is an infinite stream which will receive notifications whenever a signal is received. More documentation can be found on Signal itself, but to reiterate:

A Signal stream can be created for a particular signal number multiple times. When a signal is received then all the associated channels will receive the signal notification.

Errors

Panics

This function panics if there is no current reactor set, or if the rt feature flag is not enabled.