[][src]Type Definition arc_swap::IndependentArcSwap

type IndependentArcSwap<T> = ArcSwapAny<Arc<T>, PrivateUnsharded>;

An atomic storage that doesn't share the internal generation locks with others.

This makes it bigger and it also might suffer contention (on the HW level) if used from many threads at once. But using load_signal_safe will not block writes on other instances.

// This one shares locks with others.
let shared = ArcSwap::from_pointee(42);
// But this one has an independent lock.
let independent = IndependentArcSwap::from_pointee(42);

// This'll hold a lock so any writers there wouldn't complete
let l = independent.load_signal_safe();
// But the lock doesn't influence the shared one, so this goes through just fine
shared.store(Arc::new(43));

assert_eq!(42, **l);