Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,14 @@ 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)
#[cfg(not(thread = "sanitize"))]
atomic::fence(Ordering::Acquire);

// Thread sanitizer does not support atomic fences. Use an atomic load
// instead.
#[cfg(thread = "sanitize")]
(*ptr).ref_count.load(Ordering::Acquire);

// Drop the data
Box::from_raw(ptr);
}
Expand Down
6 changes: 6 additions & 0 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,8 +1287,14 @@ 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)
#[cfg(not(thread = "sanitize"))]
atomic::fence(Ordering::Acquire);

// Thread sanitizer does not support atomic fences. Use an atomic load
// instead.
#[cfg(thread = "sanitize")]
(*ptr).ref_count.load(Ordering::Acquire);

// Drop the data
Box::from_raw(ptr);
}
Expand Down