From fdc060c27365ebae705d78c0eda3092127ae8c3a Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 13 Apr 2017 23:00:39 -0500 Subject: [PATCH] remove system ceiling from `lock_mut` closure now it's impossible to do a `borrow` within that critical section as a borrow of the task priority is required (and that's already mutably borrowed by the `lock_mut` closure) --- src/lib.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 46a6bd794a..e2937fee3e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,8 +8,6 @@ extern crate typenum; use core::cell::UnsafeCell; use core::marker::PhantomData; -#[cfg(not(thumbv6m))] -use core::ops::Sub; use cortex_m::ctxt::Context; use cortex_m::interrupt::Nr; @@ -17,7 +15,7 @@ use cortex_m::interrupt::Nr; use cortex_m::register::{basepri, basepri_max}; use typenum::{Cmp, Equal, Unsigned}; #[cfg(not(thumbv6m))] -use typenum::{B1, Greater, Less, Sub1}; +use typenum::{Greater, Less}; pub use cortex_m::ctxt::Local; pub use cortex_m::asm::wfi; @@ -156,9 +154,8 @@ where f: F, ) -> R where - F: FnOnce(&mut T, C>) -> R, + F: FnOnce(&mut T) -> R, C: Ceiling, - CEILING: Sub, CEILING: Cmp + Cmp + Level, P: Priority, @@ -167,13 +164,7 @@ where let old_basepri = basepri::read(); basepri_max::write(::hw()); barrier!(); - let ret = f( - &mut *self.data.get(), - C { - _0: (), - _marker: PhantomData, - }, - ); + let ret = f(&mut *self.data.get()); barrier!(); basepri::write(old_basepri); ret