10次发布
0.2.0 | 2023年9月4日 |
---|---|
0.1.9 | 2023年1月22日 |
0.1.8 |
|
0.1.6 | 2022年9月7日 |
0.1.2 | 2022年7月12日 |
#342 in 并发
302每月下载量
用于 4 个Crates(2 直接)
66KB
922 行
Atomicell crate
此crate提供了AtomicCell
类型——标准库中RefCell
的多线程版本。AtomicCell
使用原子操作来跟踪借用,并能够在多个线程并发尝试借用时保证没有可变别名。
与互斥锁和自旋锁不同,AtomicCell
没有阻塞调用。借用要么立即成功,要么失败。
存在返回可选类型的可失败调用——AtomicCell::try_borrow
和AtomicCell::try_borrow_mut
。
以及恐慌版本——AtomicCell::borrow
和AtomicCell::borrow_mut
。