chiark / gitweb /
global: Unauthorised: Provide lock_even_poisoned
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 27 Mar 2021 11:40:46 +0000 (11:40 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 27 Mar 2021 11:41:51 +0000 (11:41 +0000)
We're going to want this for list-games

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/global.rs

index d24bf57995d473a091a91b744090b22f98777d87..488ca3360aba6f7313fb09a98ae5469ec62bba81 100644 (file)
@@ -313,6 +313,14 @@ impl<A> Unauthorised<InstanceRef, A> {
     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<InstanceGuard<'r>, 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 {