Skip to content

Commit

Permalink
Rollup merge of #64349 - arnohaase:pr_documentation_atomicptr, r=cram…
Browse files Browse the repository at this point in the history
…ertj

documentation for AtomicPtr CAS operations

The examples in the documentation for AtomicPtr CAS operations only show code that does *not* perform the CAS operation. I suggest to change them so that they actually do exchange the AtomicPtr's value.
  • Loading branch information
tmandry authored Sep 10, 2019
2 parents 656ce3f + 7ad44c7 commit 02fd8f4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,8 @@ impl<T> AtomicPtr<T> {
/// let some_ptr = AtomicPtr::new(ptr);
///
/// let other_ptr = &mut 10;
/// let another_ptr = &mut 10;
///
/// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed);
/// let value = some_ptr.compare_and_swap(ptr, other_ptr, Ordering::Relaxed);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1021,9 +1020,8 @@ impl<T> AtomicPtr<T> {
/// let some_ptr = AtomicPtr::new(ptr);
///
/// let other_ptr = &mut 10;
/// let another_ptr = &mut 10;
///
/// let value = some_ptr.compare_exchange(other_ptr, another_ptr,
/// let value = some_ptr.compare_exchange(ptr, other_ptr,
/// Ordering::SeqCst, Ordering::Relaxed);
/// ```
#[inline]
Expand Down

0 comments on commit 02fd8f4

Please sign in to comment.