Rollup merge of #64349 - arnohaase:pr_documentation_atomicptr, r=cramertj

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.
This commit is contained in:
Mazdak Farrokhzad 2019-09-11 02:38:10 +02:00 committed by GitHub
commit 4f1d50e65f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")]
@ -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]