doc: add a comment in cancel_during_run. (#5267)
Signed-off-by: Tricster <mediosrity@gmail.com> Signed-off-by: Tricster <mediosrity@gmail.com>
This commit is contained in:
@@ -269,6 +269,9 @@ async fn cancel_during_run() {
|
||||
*caller.data_mut() = 1;
|
||||
let dtor = SetOnDrop(caller);
|
||||
Box::new(async move {
|
||||
// SetOnDrop is not destroyed when dropping the reference of it
|
||||
// here. Instead, it is moved into the future where it's forced
|
||||
// to live in and will be destroyed at the end of the future.
|
||||
drop(&dtor);
|
||||
tokio::task::yield_now().await;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user