mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
implement lock_mut
This commit is contained in:
parent
fb20b51528
commit
f62af15cfd
2 changed files with 59 additions and 2 deletions
16
tests/cfail/lock_mut.rs
Normal file
16
tests/cfail/lock_mut.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extern crate cortex_m_srp;
|
||||
|
||||
use cortex_m_srp::{C3, C4, P2, Resource};
|
||||
|
||||
static R1: Resource<i32, C4> = Resource::new(0);
|
||||
static R2: Resource<i32, C3> = Resource::new(0);
|
||||
|
||||
fn j1(mut prio: P2) {
|
||||
R1.lock_mut(
|
||||
&mut prio, |r1: &mut i32, c3| {
|
||||
let r2 = R2.borrow(&c3);
|
||||
let another_r1: &i32 = R1.borrow(&c3);
|
||||
//~^ error
|
||||
}
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue