summaryrefslogtreecommitdiff
path: root/src/collection/boxed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/collection/boxed.rs')
-rw-r--r--src/collection/boxed.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/collection/boxed.rs b/src/collection/boxed.rs
index 2397bd3..a048d2b 100644
--- a/src/collection/boxed.rs
+++ b/src/collection/boxed.rs
@@ -21,9 +21,9 @@ fn contains_duplicates(l: &[&dyn RawLock]) -> bool {
}
unsafe impl<L: Lockable> RawLock for BoxedLockCollection<L> {
- fn kill(&self) {
+ fn poison(&self) {
for lock in &self.locks {
- lock.kill();
+ lock.poison();
}
}
@@ -196,6 +196,8 @@ impl<L> BoxedLockCollection<L> {
self.locks.clear();
// safety: this was allocated using a box, and is now unique
let boxed: Box<UnsafeCell<L>> = Box::from_raw(self.data.cast_mut());
+ // to prevent a double free
+ std::mem::forget(self);
boxed.into_inner()
}