diff options
Diffstat (limited to 'src/context/context.rs')
| -rw-r--r-- | src/context/context.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/context/context.rs b/src/context/context.rs index adc684f..80a1881 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -7,7 +7,9 @@ use crate::{ }; impl<'l, L> LockContext<'l, L> { - pub(crate) const fn new(lockable: &'l L) -> Self + /// Safety: Don't lock the locks in a different order than what the + /// LockContext uses + pub(crate) const unsafe fn new(lockable: &'l L) -> Self where L: OwnedLockable, { @@ -56,6 +58,8 @@ impl<'l, L> LockContext<'l, L> { /// ``` /// /// [`ContextGuard`]: `crate::context::ContextGuard` + // The mutable reference ensures that all of the guards, which have a shared + // borrow to the context, must be dropped first pub fn unlock(&mut self) -> Option<ThreadKey> { self.key.take() } |
