aboutsummaryrefslogtreecommitdiff
path: root/book/en/src/by-example/resources.md
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-11-12 18:34:05 +0000
committerGitHub <noreply@github.com>2020-11-12 18:34:05 +0000
commitebfabd7b307c7a1d60a5fa10eda5e5ba2514ee74 (patch)
tree34bf9c24a83cef1212a0f6301bb38214341b26c7 /book/en/src/by-example/resources.md
parent65d0ee1f8e307cc26c2628c897fdbd13ff9ba06d (diff)
parentb0f6d60c3d9a6b6052d56caddb54d73017668206 (diff)
Merge #411
411: Add section about task_local and lock_free r=perlindgren a=AfoHT Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'book/en/src/by-example/resources.md')
-rw-r--r--book/en/src/by-example/resources.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/book/en/src/by-example/resources.md b/book/en/src/by-example/resources.md
index 91d143e..301961d 100644
--- a/book/en/src/by-example/resources.md
+++ b/book/en/src/by-example/resources.md
@@ -102,3 +102,15 @@ In the example below a key (e.g. a cryptographic key) is loaded (or created) at
$ cargo run --example only-shared-access
{{#include ../../../../ci/expected/only-shared-access.run}}
```
+
+## Lock-free resource access of mutable resources
+
+There exists two other options dealing with resources
+
+* `#[lock_free]`: there might be several tasks with the same priority
+ accessing the resource without critical section. Since tasks with the
+ same priority never can preempt another task on the same priority
+ this is safe.
+* `#[task_local]`: there must be only one task using this resource,
+ similar to a `static mut` task local resource, but (optionally) set-up by init.
+