https://github.com/zakarumych/atomicell
Multi-threaded RefCell on atomics
https://github.com/zakarumych/atomicell
atomics multi-threading parallel-programming rust synchronization
Last synced: 6 months ago
JSON representation
Multi-threaded RefCell on atomics
- Host: GitHub
- URL: https://github.com/zakarumych/atomicell
- Owner: zakarumych
- License: other
- Created: 2022-07-12T14:57:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-04T19:34:56.000Z (about 2 years ago)
- Last Synced: 2024-10-31T11:26:42.036Z (12 months ago)
- Topics: atomics, multi-threading, parallel-programming, rust, synchronization
- Language: Rust
- Homepage:
- Size: 43.9 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Atomicell crate
[](https://crates.io/crates/atomicell)
[](https://docs.rs/atomicell)
[](https://github.com/zakarumych/atomicell/actions/workflows/badge.yml)
[](COPYING)
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`].
[`AtomicCell::try_borrow`]: https://docs.rs/atomicell/latest/atomicell/struct.AtomicCell.html#method.try_borrow
[`AtomicCell::try_borrow_mut`]: https://docs.rs/atomicell/latest/atomicell/struct.AtomicCell.html#method.try_borrow_mut
[`AtomicCell::borrow`]: https://docs.rs/atomicell/latest/atomicell/struct.AtomicCell.html#method.borrow
[`AtomicCell::borrow_mut`]: https://docs.rs/atomicell/latest/atomicell/struct.AtomicCell.html#method.borrow_mut