mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-14 00:00:13 +02:00
Add TSAN support (#541)
This commit is contained in:
+5
-2
@@ -16,7 +16,7 @@ use crate::buf::{IntoIter, UninitSlice};
|
||||
use crate::bytes::Vtable;
|
||||
#[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, BufMut, Bytes};
|
||||
|
||||
/// A unique reference to a contiguous slice of memory.
|
||||
@@ -1288,7 +1288,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_count.load(Ordering::Acquire);
|
||||
|
||||
// Drop the data
|
||||
Box::from_raw(ptr);
|
||||
|
||||
Reference in New Issue
Block a user