Add TSAN support (#541)

This commit is contained in:
Alice Ryhl
2022-04-15 22:46:40 +02:00
committed by GitHub
parent 724476982b
commit 547a32033e
3 changed files with 12 additions and 6 deletions
+5 -2
View File
@@ -13,7 +13,7 @@ use alloc::{
use crate::buf::IntoIter;
#[allow(unused)]
use crate::loom::sync::atomic::AtomicMut;
use crate::loom::sync::atomic::{self, AtomicPtr, AtomicUsize, Ordering};
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use crate::Buf;
/// A cheaply cloneable and sliceable chunk of contiguous memory.
@@ -1095,7 +1095,10 @@ unsafe fn release_shared(ptr: *mut Shared) {
// > "acquire" operation before deleting the object.
//
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
atomic::fence(Ordering::Acquire);
//
// Thread sanitizer does not support atomic fences. Use an atomic load
// instead.
(*ptr).ref_cnt.load(Ordering::Acquire);
// Drop the data
Box::from_raw(ptr);