From e8eca4be37a2fe1af25b203ace5e99b31fcc3972 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 22 Oct 2020 21:36:32 +0200 Subject: Now all locks are symmetric Test fixes Fix test Fix comment --- examples/task-local.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'examples/task-local.rs') diff --git a/examples/task-local.rs b/examples/task-local.rs index 462a0d3..e86197a 100644 --- a/examples/task-local.rs +++ b/examples/task-local.rs @@ -61,9 +61,11 @@ mod app { // l2 ok (task_local) // e1 ok (lock_free) #[task(priority = 1, binds = UART0, resources = [shared, l2, e1])] - fn uart0(cx: uart0::Context) { - let shared: &mut u32 = cx.resources.shared; - *shared += 1; + fn uart0(mut cx: uart0::Context) { + let shared = cx.resources.shared.lock(|shared| { + *shared += 1; + *shared + }); *cx.resources.e1 += 10; hprintln!("UART0: shared = {}", shared).unwrap(); hprintln!("UART0:l2 = {}", cx.resources.l2).unwrap(); @@ -73,9 +75,11 @@ mod app { // `shared` can be accessed from this context // e1 ok (lock_free) #[task(priority = 1, binds = UART1, resources = [shared, e1])] - fn uart1(cx: uart1::Context) { - let shared: &mut u32 = cx.resources.shared; - *shared += 1; + fn uart1(mut cx: uart1::Context) { + let shared = cx.resources.shared.lock(|shared| { + *shared += 1; + *shared + }); hprintln!("UART1: shared = {}", shared).unwrap(); hprintln!("UART1:e1 = {}", cx.resources.e1).unwrap(); -- cgit v1.2.3