Crate atomic_slot

Crate atomic_slot 

Source
Expand description

A simple, lock-free, atomic slot for transferring ownership of Box<T>.

The AtomicSlot<T> holds at most one Box<T> and allows you to swap, take or store an optional value using only atomic operations.

§Examples

use atomic_slot::AtomicSlot;
use std::sync::atomic::Ordering;

let slot = AtomicSlot::new(Box::new(7));
assert_eq!(*slot.take().unwrap(), 7);
assert!(slot.is_none());

Structs§

AtomicSlot
A lock-free, thread-safe slot that may contain a Box<T>.