diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2019-09-15 17:09:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-15 17:09:40 +0000 |
| commit | 4ff28e9d13e845abf39c662643ae2ff5df57ec16 (patch) | |
| tree | 7d9770cd357e584d85ef6ddc32bddd1a937d1020 /book/en/src/internals/non-reentrancy.md | |
| parent | fafeeb27270ef24fc3852711c6032f65aa7dbcc0 (diff) | |
| parent | 7aa270cb92180abfc9102a69efdde378c3396b5e (diff) | |
Merge pull request #205 from japaric/heterogeneous
rtfm-syntax refactor + heterogeneous multi-core support
Diffstat (limited to 'book/en/src/internals/non-reentrancy.md')
| -rw-r--r-- | book/en/src/internals/non-reentrancy.md | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/book/en/src/internals/non-reentrancy.md b/book/en/src/internals/non-reentrancy.md index 408a012..f1ce2cb 100644 --- a/book/en/src/internals/non-reentrancy.md +++ b/book/en/src/internals/non-reentrancy.md @@ -13,24 +13,20 @@ are discouraged from directly invoking an interrupt handler. ``` rust #[rtfm::app(device = ..)] const APP: () = { - static mut X: u64 = 0; - #[init] fn init(c: init::Context) { .. } - #[interrupt(binds = UART0, resources = [X])] + #[interrupt(binds = UART0)] fn foo(c: foo::Context) { - let x: &mut u64 = c.resources.X; + static mut X: u64 = 0; - *x = 1; + let x: &mut u64 = X; - //~ `bar` can preempt `foo` at this point + // .. - *x = 2; + //~ `bar` can preempt `foo` at this point - if *x == 2 { - // something - } + // .. } #[interrupt(binds = UART1, priority = 2)] @@ -40,15 +36,15 @@ const APP: () = { } // this interrupt handler will invoke task handler `foo` resulting - // in mutable aliasing of the static variable `X` + // in aliasing of the static variable `X` unsafe { UART0() } } }; ``` The RTFM framework must generate the interrupt handler code that calls the user -defined task handlers. We are careful in making these handlers `unsafe` and / or -impossible to call from user code. +defined task handlers. We are careful in making these handlers impossible to +call from user code. The above example expands into: |
