@@ -25,7 +25,7 @@ use core::ptr::{self, NonNull};
2525#[ cfg( not( no_global_oom_handling) ) ]
2626use core:: slice:: from_raw_parts_mut;
2727use core:: sync:: atomic;
28- use core:: sync:: atomic:: Ordering :: { Acquire , Relaxed , Release , SeqCst } ;
28+ use core:: sync:: atomic:: Ordering :: { Acquire , Relaxed , Release } ;
2929
3030#[ cfg( not( no_global_oom_handling) ) ]
3131use crate :: alloc:: handle_alloc_error;
@@ -984,7 +984,7 @@ impl<T: ?Sized> Arc<T> {
984984 #[ must_use]
985985 #[ stable( feature = "arc_counts" , since = "1.15.0" ) ]
986986 pub fn weak_count ( this : & Self ) -> usize {
987- let cnt = this. inner ( ) . weak . load ( SeqCst ) ;
987+ let cnt = this. inner ( ) . weak . load ( Acquire ) ;
988988 // If the weak count is currently locked, the value of the
989989 // count was 0 just before taking the lock.
990990 if cnt == usize:: MAX { 0 } else { cnt - 1 }
@@ -1014,7 +1014,7 @@ impl<T: ?Sized> Arc<T> {
10141014 #[ must_use]
10151015 #[ stable( feature = "arc_counts" , since = "1.15.0" ) ]
10161016 pub fn strong_count ( this : & Self ) -> usize {
1017- this. inner ( ) . strong . load ( SeqCst )
1017+ this. inner ( ) . strong . load ( Acquire )
10181018 }
10191019
10201020 /// Increments the strong reference count on the `Arc<T>` associated with the
@@ -1976,7 +1976,7 @@ impl<T: ?Sized> Weak<T> {
19761976 #[ must_use]
19771977 #[ stable( feature = "weak_counts" , since = "1.41.0" ) ]
19781978 pub fn strong_count ( & self ) -> usize {
1979- if let Some ( inner) = self . inner ( ) { inner. strong . load ( SeqCst ) } else { 0 }
1979+ if let Some ( inner) = self . inner ( ) { inner. strong . load ( Acquire ) } else { 0 }
19801980 }
19811981
19821982 /// Gets an approximation of the number of `Weak` pointers pointing to this
@@ -1995,8 +1995,8 @@ impl<T: ?Sized> Weak<T> {
19951995 pub fn weak_count ( & self ) -> usize {
19961996 self . inner ( )
19971997 . map ( |inner| {
1998- let weak = inner. weak . load ( SeqCst ) ;
1999- let strong = inner. strong . load ( SeqCst ) ;
1998+ let weak = inner. weak . load ( Acquire ) ;
1999+ let strong = inner. strong . load ( Acquire ) ;
20002000 if strong == 0 {
20012001 0
20022002 } else {
0 commit comments