rcu_cell

Crates.iorcu_cell
lib.rsrcu_cell
version
sourcesrc
created_at2018-09-26 08:36:14.652723
updated_at2024-11-09 08:32:11.241656
descriptiona lockless rcu cell implementation
homepagehttps://github.com/Xudong-Huang/rcu_cell
repositoryhttps://github.com/Xudong-Huang/rcu_cell
max_upload_size
id86591
Cargo.toml error:TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Xudong Huang (Xudong-Huang)

documentation

https://docs.rs/rcu_cell

README

Build Status Current Crates.io Version Document

RcuCell

A lockless rcu cell implementation that can be used safely in multithread context.

Features

  • Support multi-thread read and write operations.

  • The read operation would not block other read operation.

  • The read operation is something like Arc::clone

  • The write operation is something like Atomic Swap.

  • The write operation would block all read operations.

  • The RcuCell could contain no data

  • Could be compiled with no_std

Usage

    use rcu_cell::RcuCell;
    use std::sync::Arc;

    let t = Arc::new(RcuCell::new(10));
    let t1 = t.clone();
    let t2 = t.clone();
    let d1 = t1.take().unwrap();
    assert_eq!(*d1, 10);
    assert_eq!(t1.read(), None);
    let d2 = t2.write(42);
    assert!(d2.is_none());
    let d3 = t2.read().unwrap();
    assert_eq!(*d3, 42);
Commit count: 94

cargo fmt