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:
commit
4f1d50e65f
@ -979,9 +979,8 @@ pub fn swap(&self, ptr: *mut T, order: Ordering) -> *mut 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 @@ pub fn compare_and_swap(&self, current: *mut T, new: *mut T, order: Ordering) ->
|
||||
/// 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]
|
||||
|
Loading…
Reference in New Issue
Block a user