Crate atomic_swapping[][src]

A concurrent data structure that allows for AtomicSwap::swap operations to be run on any type T.

use atomic_swapping::AtomicSwap;

let swap = AtomicSwap::new(100usize);
assert_eq!(swap.clone_inner(), 100usize);
assert_eq!(swap.swap(300usize), 100usize);
assert_eq!(swap.clone_inner(), 300usize);

This is guaranteed lock-free where atomics will be guaranteed lock-free, however it is not guaranteed wait free. Some operations may spin for a short time. All values will be properly dropped.

Modules

option

A concurrent data structure that allows for AtomicSwapOption::swap, AtomicSwapOption::take, AtomicSwapOption::set, and AtomicSwapOption::clone_inner operations to be run on any type T.

Structs

AtomicSwap

Allows shared access to T by only swap related operations. Acts like it stores an Option<T>