pub enum Signal {
Interrupt,
Terminate,
Quit,
User1,
User2,
}Expand description
Process signal.
All actors can receive process signals by calling
Runtime::receive_signals or RuntimeRef::receive_signals with their
actor reference. This causes all process signals to be relayed to the actor
which should handle them accordingly.
Notes
What happens to threads spawned outside of Heph’s control, i.e. manually
spawned, before calling rt::Setup::build is unspecified. They may still
receive a process signal or they may not. This is due to platform
limitations and differences. Any manually spawned threads spawned after
calling build should not get a process signal.
The runtime will only attempt to send the process signal to the actor once. If the message can’t be send it’s not retried. Ensure that the inbox of the actor has enough room to receive the message.
Variants
Interrupt
Interrupt signal.
This signal is received by the process when its controlling terminal wishes to interrupt the process. This signal will for example be send when Ctrl+C is pressed in most terminals.
Corresponds to POSIX signal SIGINT.
Terminate
Termination request signal.
This signal received when the process is requested to terminate. This
allows the process to perform nice termination, releasing resources and
saving state if appropriate. This signal will be send when using the
kill command for example.
Corresponds to POSIX signal SIGTERM.
Quit
Terminal quit signal.
This signal is received when the process is requested to quit and perform a core dump.
Corresponds to POSIX signal SIGQUIT.
User1
User-defined signal 1.
Corresponds to POSIX signal SIGUSR1.
User2
User-defined signal 2.
Corresponds to POSIX signal SIGUSR2.
Notes
The runtime will output various metrics about itself when it receives this signal.
Trait Implementations
sourceimpl TryFrom<Signal> for Message
impl TryFrom<Signal> for Message
sourcefn try_from(signal: Signal) -> Result<Self, Self::Error>
fn try_from(signal: Signal) -> Result<Self, Self::Error>
Converts Signal::Interrupt, Signal::Terminate and
Signal::Quit, fails for all other signals (by returning Err(())).
sourceimpl TryFrom<Signal> for ServiceMessage
Available on Linux only.
impl TryFrom<Signal> for ServiceMessage
sourcefn try_from(signal: Signal) -> Result<Self, Self::Error>
fn try_from(signal: Signal) -> Result<Self, Self::Error>
Converts Signal::Interrupt, Signal::Terminate and
Signal::Quit, fails for all other signals (by returning Err(())).