#rcu #lockless #atomic

no-std rcu_cell

a lockless rcu cell implementation

11 releases

Uses old Rust 2015

0.1.10 Apr 7, 2021
0.1.9 Apr 7, 2021
0.1.8 Jun 23, 2019
0.1.7 Apr 2, 2019
0.1.2 Sep 28, 2018

#91 in Concurrency

Download history 2/week @ 2021-01-06 10/week @ 2021-01-13 2/week @ 2021-01-20 10/week @ 2021-02-03 20/week @ 2021-02-10 28/week @ 2021-02-17 3/week @ 2021-02-24 4/week @ 2021-03-03 2/week @ 2021-03-10 1/week @ 2021-03-17 37/week @ 2021-03-24 48/week @ 2021-03-31 56/week @ 2021-04-07

56 downloads per month

LGPL-3.0

17KB
410 lines

Build Status Current Crates.io Version Document

RcuCell

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

Features

  • The write operation would not block the read operation.
  • The write operation would "block" the write operation.
  • The RcuCell could contain no data

Usage

   fn single_thread() {
        let t = RcuCell::new(Some(10));
        let x = t.read();
        let y = t.read();
        t.try_lock().unwrap().update(None);
        let z = t.read();
        let a = z.clone();
        drop(t); // t can be dropped before reader
        assert_eq!(x.map(|v| *v), Some(10));
        assert_eq!(y.map(|v| *v), Some(10));
        assert_eq!(z.map(|v| *v), None);
        assert_eq!(a.map(|v| *v), None);
    }

No runtime deps