File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ use core::{
73
73
fmt,
74
74
hash:: { Hash , Hasher } ,
75
75
mem:: { ManuallyDrop , MaybeUninit } ,
76
- ops, ptr,
76
+ ops,
77
+ ptr:: { self } ,
77
78
} ;
78
79
79
80
#[ cfg( not( feature = "portable-atomic" ) ) ]
@@ -218,14 +219,14 @@ where
218
219
& mut * ptr:: addr_of_mut!( ( * this. node_ptr. as_ptr( ) . cast:: <ArcInner <P :: Data >>( ) ) . data)
219
220
}
220
221
221
- /// Returns the number of strong ( `Arc`) pointers to this allocation
222
- pub fn strong_count ( this : & Self ) -> usize {
223
- this. inner ( ) . strong . load ( Ordering :: SeqCst )
222
+ /// Returns `true` if there are no other `Arc` pointers to the same allocation
223
+ pub fn is_unique ( this : & Self ) -> bool {
224
+ this. inner ( ) . strong . load ( Ordering :: Acquire ) == 1
224
225
}
225
226
226
227
/// Returns a mutable reference to the inner data if there are no other `Arc` pointers to the
227
228
pub fn get_mut ( this : & mut Self ) -> Option < & mut P :: Data > {
228
- if Self :: strong_count ( this) == 1 {
229
+ if Self :: is_unique ( this) {
229
230
// SAFETY: we just checked that the strong count is 1
230
231
Some ( unsafe { Self :: get_mut_unchecked ( this) } )
231
232
} else {
You can’t perform that action at this time.
0 commit comments