10 releases

0.2.0 Sep 4, 2023
0.1.9 Jan 22, 2023
0.1.8 Dec 29, 2022
0.1.6 Sep 7, 2022
0.1.2 Jul 12, 2022

#250 in Concurrency

Download history 75/week @ 2023-12-13 149/week @ 2023-12-20 45/week @ 2023-12-27 100/week @ 2024-01-03 219/week @ 2024-01-10 87/week @ 2024-01-17 50/week @ 2024-01-24 36/week @ 2024-01-31 21/week @ 2024-02-07 41/week @ 2024-02-14 125/week @ 2024-02-21 108/week @ 2024-02-28 98/week @ 2024-03-06 51/week @ 2024-03-13 249/week @ 2024-03-20 106/week @ 2024-03-27

545 downloads per month
Used in 4 crates (2 directly)

MIT/Apache

66KB
922 lines

Atomicell crate

crates docs actions MIT/Apache loc

This crate provides AtomicCell type - a multi-threaded version of RefCell from standard library. AtomicCell uses atomics to track borrows and able to guarantee absence of mutable aliasing when multiple threads try to borrow concurrently.

Unlike mutexes and spin-locks AtomicCell does not have blocking calls. Borrows are either succeed immediately or fail.

There are fallible that return optional for borrowing calls - AtomicCell::try_borrow and AtomicCell::try_borrow_mut.

And panicking version - AtomicCell::borrow and AtomicCell::borrow_mut.

No runtime deps