Make the rule tree actually threadsafe

RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.
This commit is contained in:
Anthony Ramine 2020-04-20 11:54:37 +02:00
parent 1c2de5641c
commit 7f54d14904
4 changed files with 316 additions and 320 deletions

View file

@ -44,6 +44,16 @@ impl<T> UnsafeBox<T> {
}
}
/// Returns a mutable reference to the inner value of this unsafe box.
///
/// # Safety
///
/// Given `Self::clone`, nothing prevents anyone from creating
/// multiple mutable references to the inner value, which is completely UB.
pub(crate) unsafe fn deref_mut(this: &mut Self) -> &mut T {
&mut this.inner
}
/// Drops the inner value of this unsafe box.
///
/// # Safety