#signal #tokio #async #future #web #graceful-shutdown

bin+lib tokio-shutdown

Wait for a stop signal across multiple threads

5 releases

0.1.4 May 18, 2023
0.1.3 Aug 19, 2022
0.1.2 May 27, 2022
0.1.1 May 26, 2022
0.1.0 Feb 1, 2022

#904 in Asynchronous

Download history 105/week @ 2024-04-03 192/week @ 2024-04-10 124/week @ 2024-04-17 125/week @ 2024-04-24 328/week @ 2024-05-01 142/week @ 2024-05-08 132/week @ 2024-05-15 114/week @ 2024-05-22 128/week @ 2024-05-29 132/week @ 2024-06-05 126/week @ 2024-06-12 111/week @ 2024-06-19 130/week @ 2024-06-26 208/week @ 2024-07-03 163/week @ 2024-07-10 308/week @ 2024-07-17

820 downloads per month
Used in wazzup

MIT license

11KB
88 lines

Tokio Shutdown

Build Status Repository Documentation

Tiny crate that allows to wait for a stop signal across multiple threads. Helpful mostly in server applications that run indefinitely and need a signal for graceful shutdowns.

Usage

Add tokio-shutdown to your project with cargo add tokio-shutdown (needs cargo-edit) or add it manually to your Cargo.toml:

[dependencies]
tokio-shutdown = "<latest-version>"

In addition, you will need to use the lastest tokio runtime to use this library, as it uses async/await and is bound to this runtime.

Example

For examples check out the basic and streaming, or consult the docs.

License

This project is licensed under MIT License (or http://opensource.org/licenses/MIT).

Dependencies

~3–12MB
~116K SLoC