@@ -272,13 +272,13 @@ impl AtomicBool {
272
272
unsafe { atomic_swap ( self . v . get ( ) , val, order) > 0 }
273
273
}
274
274
275
- /// Stores a value into the bool if the current value is the same as the expected value.
275
+ /// Stores a value into the ` bool` if the current value is the same as the `current` value.
276
276
///
277
- /// The return value is always the previous value. If it is equal to `old `, then the value was
278
- /// updated.
277
+ /// The return value is always the previous value. If it is equal to `current `, then the value
278
+ /// was updated.
279
279
///
280
- /// `swap ` also takes an `Ordering` argument which describes the memory ordering of this
281
- /// operation.
280
+ /// `compare_and_swap ` also takes an `Ordering` argument which describes the memory ordering of
281
+ /// this operation.
282
282
///
283
283
/// # Examples
284
284
///
@@ -295,11 +295,11 @@ impl AtomicBool {
295
295
/// ```
296
296
#[ inline]
297
297
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
298
- pub fn compare_and_swap ( & self , old : bool , new : bool , order : Ordering ) -> bool {
299
- let old = if old { UINT_TRUE } else { 0 } ;
298
+ pub fn compare_and_swap ( & self , current : bool , new : bool , order : Ordering ) -> bool {
299
+ let current = if current { UINT_TRUE } else { 0 } ;
300
300
let new = if new { UINT_TRUE } else { 0 } ;
301
301
302
- unsafe { atomic_compare_and_swap ( self . v . get ( ) , old , new, order) > 0 }
302
+ unsafe { atomic_compare_and_swap ( self . v . get ( ) , current , new, order) > 0 }
303
303
}
304
304
305
305
/// Logical "and" with a boolean value.
@@ -515,10 +515,10 @@ impl AtomicIsize {
515
515
unsafe { atomic_swap ( self . v . get ( ) , val, order) }
516
516
}
517
517
518
- /// Stores a value into the isize if the current value is the same as the expected value.
518
+ /// Stores a value into the ` isize` if the current value is the same as the `current` value.
519
519
///
520
- /// The return value is always the previous value. If it is equal to `old `, then the value was
521
- /// updated.
520
+ /// The return value is always the previous value. If it is equal to `current `, then the value
521
+ /// was updated.
522
522
///
523
523
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
524
524
/// this operation.
@@ -538,8 +538,8 @@ impl AtomicIsize {
538
538
/// ```
539
539
#[ inline]
540
540
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
541
- pub fn compare_and_swap ( & self , old : isize , new : isize , order : Ordering ) -> isize {
542
- unsafe { atomic_compare_and_swap ( self . v . get ( ) , old , new, order) }
541
+ pub fn compare_and_swap ( & self , current : isize , new : isize , order : Ordering ) -> isize {
542
+ unsafe { atomic_compare_and_swap ( self . v . get ( ) , current , new, order) }
543
543
}
544
544
545
545
/// Add an isize to the current value, returning the previous value.
@@ -709,10 +709,10 @@ impl AtomicUsize {
709
709
unsafe { atomic_swap ( self . v . get ( ) , val, order) }
710
710
}
711
711
712
- /// Stores a value into the usize if the current value is the same as the expected value.
712
+ /// Stores a value into the ` usize` if the current value is the same as the `current` value.
713
713
///
714
- /// The return value is always the previous value. If it is equal to `old `, then the value was
715
- /// updated.
714
+ /// The return value is always the previous value. If it is equal to `current `, then the value
715
+ /// was updated.
716
716
///
717
717
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
718
718
/// this operation.
@@ -732,8 +732,8 @@ impl AtomicUsize {
732
732
/// ```
733
733
#[ inline]
734
734
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
735
- pub fn compare_and_swap ( & self , old : usize , new : usize , order : Ordering ) -> usize {
736
- unsafe { atomic_compare_and_swap ( self . v . get ( ) , old , new, order) }
735
+ pub fn compare_and_swap ( & self , current : usize , new : usize , order : Ordering ) -> usize {
736
+ unsafe { atomic_compare_and_swap ( self . v . get ( ) , current , new, order) }
737
737
}
738
738
739
739
/// Add to the current usize, returning the previous value.
@@ -910,10 +910,10 @@ impl<T> AtomicPtr<T> {
910
910
unsafe { atomic_swap ( self . p . get ( ) as * mut usize , ptr as usize , order) as * mut T }
911
911
}
912
912
913
- /// Stores a value into the pointer if the current value is the same as the expected value.
913
+ /// Stores a value into the pointer if the current value is the same as the `current` value.
914
914
///
915
- /// The return value is always the previous value. If it is equal to `old `, then the value was
916
- /// updated.
915
+ /// The return value is always the previous value. If it is equal to `current `, then the value
916
+ /// was updated.
917
917
///
918
918
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
919
919
/// this operation.
@@ -933,9 +933,9 @@ impl<T> AtomicPtr<T> {
933
933
/// ```
934
934
#[ inline]
935
935
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
936
- pub fn compare_and_swap ( & self , old : * mut T , new : * mut T , order : Ordering ) -> * mut T {
936
+ pub fn compare_and_swap ( & self , current : * mut T , new : * mut T , order : Ordering ) -> * mut T {
937
937
unsafe {
938
- atomic_compare_and_swap ( self . p . get ( ) as * mut usize , old as usize ,
938
+ atomic_compare_and_swap ( self . p . get ( ) as * mut usize , current as usize ,
939
939
new as usize , order) as * mut T
940
940
}
941
941
}
0 commit comments