aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-04-12 10:43:36 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-04-12 10:43:36 -0500
commitfb20b5152822462de2b5482f590c8f18078ec70b (patch)
tree5a5aa2cb55ce0705fcab688c1e77f4351df53107 /src/lib.rs
parentd9300f01f8caf619c65de15f2bbe76672bde9980 (diff)
add `claim_mut`
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index dfc5e52..7b170fc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,6 +83,19 @@ where
unsafe { &*self.data.get() }
}
+ /// Like [Resource.claim](struct.Resource.html#method.claim) but returns a
+ /// `&mut-` reference
+ pub fn claim_mut<'task, PRIORITY>(
+ &'static self,
+ _priority: &'task mut P<PRIORITY>,
+ ) -> &'task mut T
+ where
+ CEILING: Cmp<PRIORITY, Output = Equal>,
+ P<PRIORITY>: Priority,
+ {
+ unsafe { &mut *self.data.get() }
+ }
+
/// Locks the resource for the duration of the critical section `f`
///
/// For the duration of the critical section, tasks whose priority level is