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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Converts Signal::Interrupt, Signal::Terminate and Signal::Quit, fails for all other signals (by returning Err(())).

The type returned in the event of a conversion error.

Converts Signal::Interrupt, Signal::Terminate and Signal::Quit, fails for all other signals (by returning Err(())).

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.