mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
critical: don't let the ceiling token escape the critical section
This commit is contained in:
parent
aee1d785a9
commit
aee3c2b29b
2 changed files with 14 additions and 4 deletions
|
|
@ -238,12 +238,12 @@ where
|
|||
/// No task can preempt this critical section
|
||||
pub fn critical<R, F>(f: F) -> R
|
||||
where
|
||||
F: FnOnce(CMAX) -> R,
|
||||
F: FnOnce(&CMAX) -> R,
|
||||
{
|
||||
let primask = ::cortex_m::register::primask::read();
|
||||
::cortex_m::interrupt::disable();
|
||||
|
||||
let r = f(C { _marker: PhantomData });
|
||||
let r = f(&C { _marker: PhantomData });
|
||||
|
||||
// If the interrupts were active before our `disable` call, then re-enable
|
||||
// them. Otherwise, keep them disabled
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue