File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use alloc::{
1313use crate :: buf:: IntoIter ;
1414#[ allow( unused) ]
1515use crate :: loom:: sync:: atomic:: AtomicMut ;
16- use crate :: loom:: sync:: atomic:: { self , AtomicPtr , AtomicUsize , Ordering } ;
16+ use crate :: loom:: sync:: atomic:: { AtomicPtr , AtomicUsize , Ordering } ;
1717use crate :: Buf ;
1818
1919/// A cheaply cloneable and sliceable chunk of contiguous memory.
@@ -1095,7 +1095,10 @@ unsafe fn release_shared(ptr: *mut Shared) {
10951095 // > "acquire" operation before deleting the object.
10961096 //
10971097 // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
1098- atomic:: fence ( Ordering :: Acquire ) ;
1098+ //
1099+ // Thread sanitizer does not support atomic fences. Use an atomic load
1100+ // instead.
1101+ ( * ptr) . ref_cnt . load ( Ordering :: Acquire ) ;
10991102
11001103 // Drop the data
11011104 Box :: from_raw ( ptr) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ use crate::buf::{IntoIter, UninitSlice};
1616use crate :: bytes:: Vtable ;
1717#[ allow( unused) ]
1818use crate :: loom:: sync:: atomic:: AtomicMut ;
19- use crate :: loom:: sync:: atomic:: { self , AtomicPtr , AtomicUsize , Ordering } ;
19+ use crate :: loom:: sync:: atomic:: { AtomicPtr , AtomicUsize , Ordering } ;
2020use crate :: { Buf , BufMut , Bytes } ;
2121
2222/// A unique reference to a contiguous slice of memory.
@@ -1288,7 +1288,10 @@ unsafe fn release_shared(ptr: *mut Shared) {
12881288 // > "acquire" operation before deleting the object.
12891289 //
12901290 // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
1291- atomic:: fence ( Ordering :: Acquire ) ;
1291+ //
1292+ // Thread sanitizer does not support atomic fences. Use an atomic load
1293+ // instead.
1294+ ( * ptr) . ref_count . load ( Ordering :: Acquire ) ;
12921295
12931296 // Drop the data
12941297 Box :: from_raw ( ptr) ;
Original file line number Diff line number Diff line change 11#[ cfg( not( all( test, loom) ) ) ]
22pub ( crate ) mod sync {
33 pub ( crate ) mod atomic {
4- pub ( crate ) use core:: sync:: atomic:: { fence , AtomicPtr , AtomicUsize , Ordering } ;
4+ pub ( crate ) use core:: sync:: atomic:: { AtomicPtr , AtomicUsize , Ordering } ;
55
66 pub ( crate ) trait AtomicMut < T > {
77 fn with_mut < F , R > ( & mut self , f : F ) -> R
@@ -23,7 +23,7 @@ pub(crate) mod sync {
2323#[ cfg( all( test, loom) ) ]
2424pub ( crate ) mod sync {
2525 pub ( crate ) mod atomic {
26- pub ( crate ) use loom:: sync:: atomic:: { fence , AtomicPtr , AtomicUsize , Ordering } ;
26+ pub ( crate ) use loom:: sync:: atomic:: { AtomicPtr , AtomicUsize , Ordering } ;
2727
2828 pub ( crate ) trait AtomicMut < T > { }
2929 }
You can’t perform that action at this time.
0 commit comments