diff options
author | 2017-04-20 10:53:35 -0500 | |
---|---|---|
committer | 2017-04-20 10:53:35 -0500 | |
commit | 03b94e691b282002912433266be4ba74df64c6d7 (patch) | |
tree | 3ba6760fc3a403c7f9f44d3e62baea975d430c30 /src/interrupt.rs | |
parent | 492981a7a121e660593ef597cacd60c3b30d8970 (diff) | |
download | cortex-m-03b94e691b282002912433266be4ba74df64c6d7.tar.gz cortex-m-03b94e691b282002912433266be4ba74df64c6d7.tar.zst cortex-m-03b94e691b282002912433266be4ba74df64c6d7.zip |
interrupt::free: don't let the token escape the critical section
Diffstat (limited to 'src/interrupt.rs')
-rw-r--r-- | src/interrupt.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interrupt.rs b/src/interrupt.rs index a96b845..a4eac00 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -75,14 +75,14 @@ pub struct CriticalSection { /// This as also known as a "critical section". pub fn free<F, R>(f: F) -> R where - F: FnOnce(CriticalSection) -> R, + F: FnOnce(&CriticalSection) -> R, { let primask = ::register::primask::read(); // disable interrupts disable(); - let r = f(CriticalSection { _0: () }); + let r = f(&CriticalSection { _0: () }); // If the interrupts were active before our `disable` call, then re-enable // them. Otherwise, keep them disabled |