4 releases
0.1.3 | Jan 20, 2024 |
---|---|
0.1.2 | Jul 26, 2022 |
0.1.1 | Jul 26, 2022 |
0.1.0 | Jul 26, 2022 |
#263 in Concurrency
1,611 downloads per month
6KB
81 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–26MB
~329K SLoC