@@ -25,7 +25,7 @@ use core::ptr::{self, NonNull};
25
25
#[ cfg( not( no_global_oom_handling) ) ]
26
26
use core:: slice:: from_raw_parts_mut;
27
27
use core:: sync:: atomic;
28
- use core:: sync:: atomic:: Ordering :: { Acquire , Relaxed , Release , SeqCst } ;
28
+ use core:: sync:: atomic:: Ordering :: { Acquire , Relaxed , Release } ;
29
29
30
30
#[ cfg( not( no_global_oom_handling) ) ]
31
31
use crate :: alloc:: handle_alloc_error;
@@ -970,7 +970,7 @@ impl<T: ?Sized> Arc<T> {
970
970
#[ must_use]
971
971
#[ stable( feature = "arc_counts" , since = "1.15.0" ) ]
972
972
pub fn weak_count ( this : & Self ) -> usize {
973
- let cnt = this. inner ( ) . weak . load ( SeqCst ) ;
973
+ let cnt = this. inner ( ) . weak . load ( Acquire ) ;
974
974
// If the weak count is currently locked, the value of the
975
975
// count was 0 just before taking the lock.
976
976
if cnt == usize:: MAX { 0 } else { cnt - 1 }
@@ -1000,7 +1000,7 @@ impl<T: ?Sized> Arc<T> {
1000
1000
#[ must_use]
1001
1001
#[ stable( feature = "arc_counts" , since = "1.15.0" ) ]
1002
1002
pub fn strong_count ( this : & Self ) -> usize {
1003
- this. inner ( ) . strong . load ( SeqCst )
1003
+ this. inner ( ) . strong . load ( Acquire )
1004
1004
}
1005
1005
1006
1006
/// Increments the strong reference count on the `Arc<T>` associated with the
@@ -1961,7 +1961,7 @@ impl<T: ?Sized> Weak<T> {
1961
1961
#[ must_use]
1962
1962
#[ stable( feature = "weak_counts" , since = "1.41.0" ) ]
1963
1963
pub fn strong_count ( & self ) -> usize {
1964
- if let Some ( inner) = self . inner ( ) { inner. strong . load ( SeqCst ) } else { 0 }
1964
+ if let Some ( inner) = self . inner ( ) { inner. strong . load ( Acquire ) } else { 0 }
1965
1965
}
1966
1966
1967
1967
/// Gets an approximation of the number of `Weak` pointers pointing to this
@@ -1980,8 +1980,8 @@ impl<T: ?Sized> Weak<T> {
1980
1980
pub fn weak_count ( & self ) -> usize {
1981
1981
self . inner ( )
1982
1982
. map ( |inner| {
1983
- let weak = inner. weak . load ( SeqCst ) ;
1984
- let strong = inner. strong . load ( SeqCst ) ;
1983
+ let weak = inner. weak . load ( Acquire ) ;
1984
+ let strong = inner. strong . load ( Acquire ) ;
1985
1985
if strong == 0 {
1986
1986
0
1987
1987
} else {
0 commit comments