Crate shutdown

source ·
Expand description

shutdown

This crate is meant to be used together with Tokio as it provides an async solution for listening and forwarding shutdown signals.

When creating a new “root” shutdown signal, it will register itself to listen for SIGINT and SIGTERM signals. When a SIGNINT or SIGTERM is received, it will unregister itself again so any additional signals will be processed as usual (interrupting or terminating the process in most cases). Besides a SIGINT or SIGTERM signal, you can also trigger a shutdown signal manually by calling signal.

You can form a tree of branches and subscribers and choose to only shutdown a specific branch. This will shutdown all subscribers but also any child branches and their subscribers. This can be helpful in async applications where lots of tasks spawn lots of tasks, that spawn lots of tasks…

Structs