aboutsummaryrefslogtreecommitdiff
path: root/tests/cfail/borrow.rs
diff options
context:
space:
mode:
authorJorge Aparicio <jorge@japaric.io>2017-04-21 15:31:02 -0500
committerJorge Aparicio <jorge@japaric.io>2017-04-21 15:31:02 -0500
commit3e165f2a42b8f3c66e3e77742a54feb875ec4bd6 (patch)
tree40fed29e8d94ac1d3b678ad3617a8e957e679f3c /tests/cfail/borrow.rs
parent854939fc6b523479a7540d8ac9d0933d9c3dcb78 (diff)
drop `lock` methods, add `raise_to` function
Diffstat (limited to 'tests/cfail/borrow.rs')
-rw-r--r--tests/cfail/borrow.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/cfail/borrow.rs b/tests/cfail/borrow.rs
index ca246e7..d72402d 100644
--- a/tests/cfail/borrow.rs
+++ b/tests/cfail/borrow.rs
@@ -10,22 +10,24 @@ static R5: Resource<i32, C1> = Resource::new(0);
static R6: Resource<i32, C2> = Resource::new(0);
fn j1(prio: P2) {
- R1.lock(&prio, |r1, c3| {
- // CAN borrow a resource with ceiling C when the system ceiling SC > C
- let r2 = R2.borrow(&prio, &c3);
+ let ceil = prio.as_ceiling();
- // CAN borrow a resource with ceiling C when the system ceiling SC == C
- let r3 = R3.borrow(&prio, &c3);
+ rtfm::raise_to(ceil, &R1, |ceil| {
+ // CAN borrow a resource with ceiling C when the current ceiling SC > C
+ let r2 = R2.borrow(&prio, ceil);
- // CAN'T borrow a resource with ceiling C when the system ceiling SC < C
- let r4 = R4.borrow(&prio, &c3);
+ // CAN borrow a resource with ceiling C when the current ceiling SC == C
+ let r3 = R3.borrow(&prio, ceil);
+
+ // CAN'T borrow a resource with ceiling C when the current ceiling SC < C
+ let r4 = R4.borrow(&prio, ceil);
//~^ error
// CAN'T borrow a resource with ceiling C < P (task priority)
- let r5 = R5.borrow(&prio, &c3);
+ let r5 = R5.borrow(&prio, ceil);
//~^ error
// CAN borrow a resource with ceiling C == P (task priority)
- let r6 = R6.borrow(&prio, &c3);
+ let r6 = R6.borrow(&prio, ceil);
});
}