ArcSwap

Travis Build Status AppVeyor Build status

The Rust's [Arc] can be used from multiple threads and the count is safely updated as needed. However, the [Arc] itself can't be atomically replaced. To do that, one needs to place it under a lock.

On the other hand, [AtomicPtr] can be replaced atomically, but it's hard to know when the target can be safely freed.

This is a cross-breed between the two ‒ an [ArcSwap] can be seeded with an [Arc] and the [Arc] can be simultaneously replaced and read by multiple threads without any locking.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.