Expand description
An attempt at creating an Arc-RwLock combination that is straightforward to use and no hassle , instead of worrying about being fast and lean.
- cloning referefences works like Arc
- made for sharing objects between threads without worry
- locking things works like RwLock with write() or read()
- it spins a few times and then queues if a lock is not obtained
- miri seems to be happy , so i trust it doesnt leak too much memory etc.
- requires that everything you stick into it is Send+Sync
- no need to constantly .unwrap() things instead it will just block forever or blow up
Example
use cura::Cura;
let t:i32=2;
let foo=Cura::new(t);
let a=foo.clone();
let b=foo.clone();
{
let lock=a.read();
let v=*lock;
assert_eq!(v,2)
}//lock dropped here
{
(*b.write())+=1; //lock dropped here i think
}
assert_eq!((*a.read()),3);
Structs
- a sort of an Arc that will both readwrite lock , be easy to handle and is cloneable
- writeguard for Cura
- readguard for Cura