mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
Add section about task_local and lock_free
This commit is contained in:
parent
98f0a96104
commit
29b81a23d6
1 changed files with 12 additions and 0 deletions
|
@ -136,3 +136,15 @@ any kind of lock.
|
||||||
$ cargo run --example only-shared-access
|
$ cargo run --example only-shared-access
|
||||||
{{#include ../../../../ci/expected/only-shared-access.run}}
|
{{#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.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue