@@ -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;
@@ -984,7 +984,7 @@ impl<T: ?Sized> Arc<T> {
984
984
#[ must_use]
985
985
#[ stable( feature = "arc_counts" , since = "1.15.0" ) ]
986
986
pub fn weak_count ( this : & Self ) -> usize {
987
- let cnt = this. inner ( ) . weak . load ( SeqCst ) ;
987
+ let cnt = this. inner ( ) . weak . load ( Acquire ) ;
988
988
// If the weak count is currently locked, the value of the
989
989
// count was 0 just before taking the lock.
990
990
if cnt == usize:: MAX { 0 } else { cnt - 1 }
@@ -1014,7 +1014,7 @@ impl<T: ?Sized> Arc<T> {
1014
1014
#[ must_use]
1015
1015
#[ stable( feature = "arc_counts" , since = "1.15.0" ) ]
1016
1016
pub fn strong_count ( this : & Self ) -> usize {
1017
- this. inner ( ) . strong . load ( SeqCst )
1017
+ this. inner ( ) . strong . load ( Acquire )
1018
1018
}
1019
1019
1020
1020
/// Increments the strong reference count on the `Arc<T>` associated with the
@@ -1976,7 +1976,7 @@ impl<T: ?Sized> Weak<T> {
1976
1976
#[ must_use]
1977
1977
#[ stable( feature = "weak_counts" , since = "1.41.0" ) ]
1978
1978
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 }
1980
1980
}
1981
1981
1982
1982
/// Gets an approximation of the number of `Weak` pointers pointing to this
@@ -1995,8 +1995,8 @@ impl<T: ?Sized> Weak<T> {
1995
1995
pub fn weak_count ( & self ) -> usize {
1996
1996
self . inner ( )
1997
1997
. 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 ) ;
2000
2000
if strong == 0 {
2001
2001
0
2002
2002
} else {
0 commit comments