3 releases
0.1.2 | Jul 26, 2022 |
---|---|
0.1.1 | Jul 26, 2022 |
0.1.0 | Jul 26, 2022 |
#741 in Concurrency
2,442 downloads per month
5KB
73 lines
left-right-cell
left-right-cell is a lockfree, eventually consistent cell created using the left-right
crate.
It allows readers to read from the cell without ever blocking while the writer might block when writing.
This is achived by storing two copies of the data one for the readers and one for the writer.
let (mut w, r) = left_right_cell::new(false);
let t = std::thread::spawn(move || {
loop {
let value = r.get().unwrap();
if *value {
break;
}
}
});
w.set(true);
w.publish();
t.join().unwrap();
assert!(true);
lib.rs
:
left-right-cell is a lockfree, eventually consistent cell created using the left-right
crate.
It allows readers to read from the cell without ever blocking while the writer might block when writing.
This is achived by storing to copies of the data one for the readers and one for the writer.
Dependencies
~0.1–32MB
~441K SLoC