diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -1,5 +1,6 @@ #![warn(clippy::pedantic)] #![warn(clippy::nursery)] +#![allow(clippy::module_name_repetitions)] use std::any::type_name; use std::fmt::{self, Debug}; @@ -9,9 +10,12 @@ use once_cell::sync::Lazy; use thread_local::ThreadLocal; mod lock; +pub mod mutex; use lock::{Key, Lock}; +pub use mutex::Mutex; + static KEY: Lazy<ThreadLocal<Lock>> = Lazy::new(ThreadLocal::new); /// The key for the current thread. @@ -50,15 +54,4 @@ 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(); - } } |
