diff options
| author | Oleksandr Babak <alexanderbabak@proton.me> | 2025-03-23 11:49:08 +0100 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2025-03-27 14:47:11 +0000 |
| commit | b75b8f98b0b3c00e608778aa64d2c90bc3cddb97 (patch) | |
| tree | 4cf97dc93d58fdb038328bc18fbe2e7f9d71c359 | |
| parent | c43788f141650805aa53aa882f9b5290b1dcdceb (diff) | |
doc: add a timely yield notice
| -rw-r--r-- | book/en/src/by-example/software_tasks.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/book/en/src/by-example/software_tasks.md b/book/en/src/by-example/software_tasks.md index f18e746..462c9e3 100644 --- a/book/en/src/by-example/software_tasks.md +++ b/book/en/src/by-example/software_tasks.md @@ -86,7 +86,7 @@ $ cargo xtask qemu --verbose --example spawn_arguments ## Divergent tasks -A task can have one of two signatures: `async fn({name}::Context, ..)` or `async fn({name}::Context, ..) -> !`. The latter defines a *divergent* task — one that never returns. The key advantage of divergent tasks is that they receive a `'static` context, and `local` resources have `'static` lifetime. Additionally, using this signature makes the task’s intent explicit, clearly distinguishing between short-lived tasks and those that run indefinitely. +A task can have one of two signatures: `async fn({name}::Context, ..)` or `async fn({name}::Context, ..) -> !`. The latter defines a *divergent* task — one that never returns. The key advantage of divergent tasks is that they receive a `'static` context, and `local` resources have `'static` lifetime. Additionally, using this signature makes the task’s intent explicit, clearly distinguishing between short-lived tasks and those that run indefinitely. Be mindful not to starve other tasks at the same priority level by ensuring you yield control with `.await`. ## Priority zero tasks |
