summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 22a8d9c..777ccf3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -50,4 +50,15 @@ impl ThreadKey {
pub fn unlock(key: Self) {
drop(key);
}
+
+ /// Unlocks the `ThreadKey` without consuming it.
+ ///
+ /// # Safety
+ ///
+ /// This should only be called if the `ThreadKey` to the lock has been
+ /// "lost". That means the program no longer has a reference to the key,
+ /// but it has not been dropped.
+ pub unsafe fn force_unlock() {
+ KEY.get_or_default().force_unlock();
+ }
}