Crates.io | atomicell |
lib.rs | atomicell |
version | 0.2.0 |
source | src |
created_at | 2022-07-12 15:52:37.816141 |
updated_at | 2023-09-04 19:34:33.885007 |
description | Multi-threaded RefCell on atomics |
homepage | https://github.com/zakarumych/atomicell |
repository | https://github.com/zakarumych/atomicell |
max_upload_size | |
id | 624481 |
size | 71,621 |
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
.