diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2019-08-21 10:17:27 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2019-08-21 10:17:27 +0200 |
| commit | 07b2b4d83078d0fd260d5f0812e8d5a34d02b793 (patch) | |
| tree | dba2a8e8316e8cd868ccb7b46a80d63c5f61a224 /book/en/src/internals/non-reentrancy.md | |
| parent | 0e146f8d1142672725b6abb38478f503a9261c80 (diff) | |
doc up
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: |
