From c43788f141650805aa53aa882f9b5290b1dcdceb Mon Sep 17 00:00:00 2001 From: Oleksandr Babak Date: Sun, 23 Mar 2025 11:42:22 +0100 Subject: [PATCH] doc: add a paragraph to `software_tasks.md` --- book/en/src/by-example/software_tasks.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/book/en/src/by-example/software_tasks.md b/book/en/src/by-example/software_tasks.md index 5d5ef71b8d8..f18e746def7 100644 --- a/book/en/src/by-example/software_tasks.md +++ b/book/en/src/by-example/software_tasks.md @@ -84,6 +84,10 @@ $ cargo xtask qemu --verbose --example spawn_arguments {{#include ../../../../ci/expected/lm3s6965/spawn_arguments.run}} ``` +## 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. + ## Priority zero tasks In RTIC tasks run preemptively to each other, with priority zero (0) the lowest priority. You can use priority zero tasks for background work, without any strict real-time requirements.