aboutsummaryrefslogtreecommitdiff
path: root/tests/cfail/ceiling.rs
blob: 9ddce530320816b0e87fcf76324f512c15a6f3af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extern crate cortex_m_srp;

use cortex_m_srp::{C3, P2, Resource};

static R1: Resource<(), C3> = Resource::new(());

fn j1(prio: P2) {
    let c3 = R1.lock(&prio, |r1, c3| {
        // forbidden: ceiling token can't outlive critical section
        c3  //~ error
    });

    // Would be bad: lockless access to a resource with ceiling = 3
    let r2 = R1.borrow(&prio, c3);
}