Closed Finomnis closed 1 year ago
I agree, but the thing CancellationToken
replaces is the "Telling things to shut down" section, and not the part where an mpsc channel is used.
I agree, my bad. Point stands, though.
Yes, definitely. Perhaps it would be worth creating a tool to replace the mspc channel as well.
I opened https://github.com/tokio-rs/tokio/issues/5585 for the mpsc replacement.
@Darksonn Does this mean we have to replace broadcast channel
with CancellationToken
in "Telling things to shut down" section of the doc?
Yeah, pretty much.
https://tokio.rs/tokio/topics/shutdown
This example uses an
mpsc
to propagate a shutdown request, while the recommended way of shutting down isCancellationToken
.I guess this was because
CancellationToken
wasn't stable enough yet; but after the zero-unsafe rewrite, it should be stable enough now.Solution
Adjust the documentation so it mentions
CancellationToken
in the page about shutting down.