Crates.io | cb-stm-temp |
lib.rs | cb-stm-temp |
version | 0.3.0 |
source | src |
created_at | 2018-05-10 04:15:02.802988 |
updated_at | 2018-05-14 14:02:47.136082 |
description | Software Transactional Memory system built on top of crossbeam-epoch |
homepage | https://github.com/k3d3/crossbeam-stm |
repository | https://github.com/k3d3/crossbeam-stm |
max_upload_size | |
id | 64629 |
size | 4,930 |
Crossbeam-STM is a Software Transactional Memory implementation using crossbeam-epoch for memory reclamation. It is meant to be as fast and consistent as possible for load speed, at the expense of having inconsistent-timed and potentially very slow writes.
THIS PROJECT IS NOT READY FOR GENERAL USAGE.
extern crate cb_stm_temp;
use cb_stm_temp::Stm;
// Create a new STM pointer with a Vec of numbers
let stm = Stm::new(vec![1,2,3,4]);
// Read from the STM
{
let data = stm.load();
println!("Current STM: {:?}", data);
}
// Update the STM pointer to add a new number
stm.update(|old| {
let mut new = old.clone();
new.push(5);
new
});
// Read the new data
{
let data = stm.load();
println!("Current STM: {:?}", data);
}