From c13d10da950ebf41b6af576199015a4e9b996762 Mon Sep 17 00:00:00 2001 From: Finomnis Date: Fri, 10 Jun 2022 11:49:29 +0200 Subject: [PATCH] Update description of example #9 --- examples/09_task_cancellation.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/09_task_cancellation.rs b/examples/09_task_cancellation.rs index 45f60cd..9ff3706 100644 --- a/examples/09_task_cancellation.rs +++ b/examples/09_task_cancellation.rs @@ -1,9 +1,11 @@ //! This example demonstrates how to implement a clean shutdown //! of a subsystem. //! -//! The central mechanism here is tokio::select, which can cancel -//! tasks once one of them finishes. This can be used to cancel -//! tasks once the shutdown was initiated. +//! There are two options to cancel tasks on shutdown: +//! - with [tokio::select] +//! - with [FutureExt::cancel_on_shutdown()] +//! +//! In this case we go with `cancel_on_shutdown()`, but `tokio::select` would be equally viable. use env_logger::{Builder, Env}; use miette::Result;