diff options
| author | Henrik Tjäder <henrik@tjaders.com> | 2020-11-12 18:15:42 +0000 |
|---|---|---|
| committer | Henrik Tjäder <henrik@tjaders.com> | 2020-11-12 18:15:42 +0000 |
| commit | 29b81a23d6fa47d33345164d9ca8c4f1367d7741 (patch) | |
| tree | 7a0929b80e8daa0244f219e068b2aa5720f071ff /book/en/src/by-example/resources.md | |
| parent | 98f0a9610401ec09709dd3dc4bd8b3f0a0c50be6 (diff) | |
Add section about task_local and lock_free
Diffstat (limited to 'book/en/src/by-example/resources.md')
| -rw-r--r-- | book/en/src/by-example/resources.md | 12 |
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 9d90fbe..c34efc9 100644 --- a/book/en/src/by-example/resources.md +++ b/book/en/src/by-example/resources.md @@ -136,3 +136,15 @@ any kind of lock. $ 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 task local resource, but (optionally) set-up by init. + |
