| Crates.io | atomic-ext |
| lib.rs | atomic-ext |
| version | 0.3.2 |
| created_at | 2024-12-23 14:49:57.014236+00 |
| updated_at | 2025-06-12 14:47:08.277598+00 |
| description | Extensions for atomic operations. |
| homepage | https://github.com/huachaohuang/atomic-ext |
| repository | |
| max_upload_size | |
| id | 1493130 |
| size | 16,007 |
AtomicArc is a lightweight atomic pointer to Arc.
The implementation is based on "split reference counting", which has similar performance with Arc.
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);