diff options
| author | Botahamec <botahamec@outlook.com> | 2022-10-27 18:47:59 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2022-10-27 18:47:59 -0400 |
| commit | 0435c4a84f320baa7e8296b2124ba4a7923d1a13 (patch) | |
| tree | 3819af93b66afdc1292f0a7bdf93cddff060f8e2 /src/lib.rs | |
| parent | 10b6575f982ea229663097bfa950a778f6809099 (diff) | |
Unsafe `force_unlock` methods
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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(); + } } |
