Expand description
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
, andAtomicSwapOption::clone_inner
operations to be run on any typeT
.
Structs§
- Atomic
Swap - Allows shared access to
T
by only swap related operations. Acts like it stores anOption<T>