From aee1d785a914365e64462ce507e27ca917da9055 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 19 Apr 2017 14:12:11 -0500 Subject: don't let the ceiling token escape the critical section --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index c1f6aa1..280c8c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,7 @@ impl Resource> { /// [Resource.borrow](struct.Resource.html#method.borrow). #[cfg(not(thumbv6m))] pub fn lock(&'static self, _priority: &P, f: F) -> R - where F: FnOnce(Ref, C) -> R, + where F: FnOnce(Ref, &C) -> R, CEILING: Cmp + Cmp + Level { unsafe { @@ -118,7 +118,7 @@ impl Resource> { basepri_max::write(::hw()); barrier!(); let ret = - f(Ref::new(&*self.data.get()), C { _marker: PhantomData }); + f(Ref::new(&*self.data.get()), &C { _marker: PhantomData }); barrier!(); basepri::write(old_basepri); ret @@ -209,7 +209,7 @@ impl Peripheral> { /// See [Resource.lock](./struct.Resource.html#method.lock) #[cfg(not(thumbv6m))] pub fn lock(&'static self, _priority: &P, f: F) -> R - where F: FnOnce(Ref, C) -> R, + where F: FnOnce(Ref, &C) -> R, CEILING: Cmp + Cmp + Level { unsafe { @@ -218,7 +218,7 @@ impl Peripheral> { barrier!(); let ret = f( Ref::new(&*self.peripheral.get()), - C { _marker: PhantomData }, + &C { _marker: PhantomData }, ); barrier!(); basepri::write(old_basepri); -- cgit v1.2.3