Skip to content

Commit

Permalink
Merge #330
Browse files Browse the repository at this point in the history
330: Fix the AtomicCell::compare_and_swap example r=stjepang a=stjepang

Closes #327

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
  • Loading branch information
bors[bot] and Stjepan Glavina committed Feb 15, 2019
2 parents ea2f68e + 7d0f46c commit 183183d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crossbeam-utils/src/atomic/atomic_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ impl<T: Copy + Eq> AtomicCell<T> {
///
/// let a = AtomicCell::new(1);
///
/// assert_eq!(a.compare_exchange(2, 3), Err(1));
/// assert_eq!(a.compare_and_swap(2, 3), 1);
/// assert_eq!(a.load(), 1);
///
/// assert_eq!(a.compare_exchange(1, 2), Ok(1));
/// assert_eq!(a.compare_and_swap(1, 2), 1);
/// assert_eq!(a.load(), 2);
/// ```
pub fn compare_and_swap(&self, current: T, new: T) -> T {
Expand Down

0 comments on commit 183183d

Please sign in to comment.