atomic-ext

Crates.ioatomic-ext
lib.rsatomic-ext
version0.3.2
created_at2024-12-23 14:49:57.014236+00
updated_at2025-06-12 14:47:08.277598+00
descriptionExtensions for atomic operations.
homepagehttps://github.com/huachaohuang/atomic-ext
repository
max_upload_size
id1493130
size16,007
Huachao Huang (huachaohuang)

documentation

README

Atomic extensions

docs

AtomicArc

AtomicArc is a lightweight atomic pointer to Arc.

The implementation is based on "split reference counting", which has similar performance with Arc.

Example

use std::sync::{atomic::Ordering, Arc},

use atomic_ext::AtomicArc;

let a = Arc::new(1);
let b = Arc::new(2);
let x = AtomicArc::new(a);
let c = x.load(Ordering::Acquire);
assert_eq!(c, a);
let c = x.swap(b, Ordering::AcqRel);
assert_eq!(c, a);
let c = x.load(Ordering::Acquire);
assert_eq!(c, b);
Commit count: 0

cargo fmt