aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-04-19 14:12:11 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-04-19 14:15:18 -0500
commitaee1d785a914365e64462ce507e27ca917da9055 (patch)
tree02e6f19e5e2d9906120d97d071b5df8afc1920e0 /src/lib.rs
parent70f573a6c4bb62b9cefd1300010b535818f72585 (diff)
don't let the ceiling token escape the critical section
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 4 insertions, 4 deletions
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<T, CEILING> Resource<T, C<CEILING>> {
/// [Resource.borrow](struct.Resource.html#method.borrow).
#[cfg(not(thumbv6m))]
pub fn lock<R, PRIORITY, F>(&'static self, _priority: &P<PRIORITY>, f: F) -> R
- where F: FnOnce(Ref<T>, C<CEILING>) -> R,
+ where F: FnOnce(Ref<T>, &C<CEILING>) -> R,
CEILING: Cmp<PRIORITY, Output = Greater> + Cmp<UMAX, Output = Less> + Level
{
unsafe {
@@ -118,7 +118,7 @@ impl<T, CEILING> Resource<T, C<CEILING>> {
basepri_max::write(<CEILING>::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<Periph, CEILING> Peripheral<Periph, C<CEILING>> {
/// See [Resource.lock](./struct.Resource.html#method.lock)
#[cfg(not(thumbv6m))]
pub fn lock<R, PRIORITY, F>(&'static self, _priority: &P<PRIORITY>, f: F) -> R
- where F: FnOnce(Ref<Periph>, C<CEILING>) -> R,
+ where F: FnOnce(Ref<Periph>, &C<CEILING>) -> R,
CEILING: Cmp<PRIORITY, Output = Greater> + Cmp<UMAX, Output = Less> + Level
{
unsafe {
@@ -218,7 +218,7 @@ impl<Periph, CEILING> Peripheral<Periph, C<CEILING>> {
barrier!();
let ret = f(
Ref::new(&*self.peripheral.get()),
- C { _marker: PhantomData },
+ &C { _marker: PhantomData },
);
barrier!();
basepri::write(old_basepri);