pub fn arc<T>(inner: T) -> ArcIllegal<T>
Expand description
Creates a new ArcIllegal, inlines ArcIllegal::new
Examples found in repository?
examples/thread_num.rs (line 4)
3 4 5 6 7 8 9 10 11 12 13 14 15
fn main() {
let mut shared_num = arc(4);
let mut cloned = shared_num.dup();
*shared_num += 2;
std::thread::spawn(move || {
*cloned += 2;
});
std::thread::sleep(std::time::Duration::from_secs(1));
assert_eq!(8, *shared_num);
}