From: Ian Jackson Date: Sat, 27 Mar 2021 11:40:46 +0000 (+0000) Subject: global: Unauthorised: Provide lock_even_poisoned X-Git-Tag: otter-0.5.0~390 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=664681344afb67d09c083db37968cea5d828d29a;p=otter.git global: Unauthorised: Provide lock_even_poisoned We're going to want this for list-games Signed-off-by: Ian Jackson --- diff --git a/src/global.rs b/src/global.rs index d24bf579..488ca336 100644 --- a/src/global.rs +++ b/src/global.rs @@ -313,6 +313,14 @@ impl Unauthorised { let must_not_escape = self.by_ref(Authorisation::authorise_any()); Unauthorised::of(must_not_escape.lock()?) } + + pub fn lock_even_poisoned<'r>(&'r self) -> Unauthorised, A> { + let must_not_escape = self.by_ref(Authorisation::authorise_any()); + Unauthorised::of(InstanceGuard { + c: must_not_escape.lock_even_poisoned(), + gref: must_not_escape.clone(), + }) + } } impl Instance {