From 07b2b4d83078d0fd260d5f0812e8d5a34d02b793 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 21 Aug 2019 10:17:27 +0200 Subject: doc up --- book/en/src/internals/non-reentrancy.md | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'book/en/src/internals/non-reentrancy.md') 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: -- cgit v1.2.3