From 32499d93228fef393e5c5e85551c0dcb3690c5f3 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Mon, 18 Nov 2024 14:59:46 +1300 Subject: [PATCH] Update src/part-guide/adv-async-await.md Co-authored-by: Travis Cross --- src/part-guide/adv-async-await.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/part-guide/adv-async-await.md b/src/part-guide/adv-async-await.md index 8f21411e..6163e8d9 100644 --- a/src/part-guide/adv-async-await.md +++ b/src/part-guide/adv-async-await.md @@ -47,7 +47,7 @@ The first two are specific to Tokio, though most runtimes provide similar facili From the perspective of writing async code (in async functions, blocks, futures, etc.), the code might stop executing at any `await` (including hidden ones in macros) and never start again. In order for your code to be correct (specifically to be *cancellation safe*), it must never leave any data in an inconsistent state at any await point. -An example of how this can go wrong is if an async function reads data into an internal buffer, then awaits the next datum. If reading the data is destructive (i.e., cannot be re-read from the original source) and the async function is cancelled, then the internal buffer will be dropped, and the data in it will be lost. +An example of how this can go wrong is if an async function reads data into an internal buffer, then awaits the next datum. If reading the data is destructive (i.e., cannot be re-read from the original source) and the async function is canceled, then the internal buffer will be dropped, and the data in it will be lost. We'll be coming back to cancellation and cancellation safety a few times in this guide, and there is a whole [chapter]() on the topic in the reference section.