From fb20b5152822462de2b5482f590c8f18078ec70b Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 12 Apr 2017 10:43:36 -0500 Subject: add `claim_mut` --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/lib.rs') 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, + ) -> &'task mut T + where + CEILING: Cmp, + P: 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 -- cgit v1.2.3