Expand description
This crate provides AtomicCell
type - a multi-threaded version of RefCell
from standard library.
AtomicCell
uses atomics to track borrows and is able to guarantee
absence of mutable aliasing when multiple threads try to borrow concurrently.
Additionally it exports borrowing primitives AtomicBorrow
and AtomicBorrowMut
in borrow
module.
These types can be used to build other abstractions with atomic borrowing capabilities.
Modules§
- borrow
- This module contains types that can be used to implement atomic borrowing.
Structs§
- Atomic
Cell - A mutable memory location with dynamically checked borrow rules
This type behaves mostly like
core::cell::RefCell
. The main difference is that this type uses atomic operations for borrowing. Thus allowing to use it in multi-threaded environment. - Ref
- Wrapper for a borrowed
AtomicCell
that will released lock on drop. - RefMut
- Wrapper for mutably borrowed
AtomicCell
that will released lock on drop.