MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / main

Function main

11_multithreading/rust/naive_count.rs:1–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1fn main() {
2 let mut data: u32 = 0;
3 let mut handles = vec![];
4
5 for _ in 0..10 {
6 let h = std::thread::spawn(move || {
7 for _ in 0..100_000 {
8 data += 1;
9 }
10 println!("{}", data);
11 });
12
13 handles.push(h);
14 }
15 for h in handles {
16 h.join().unwrap();
17 }
18 println!("{}", data);
19}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected