We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8ecf4b commit 71700c5Copy full SHA for 71700c5
exercises/20_threads/threads3.rs
@@ -27,22 +27,18 @@ impl Queue {
27
}
28
29
fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
30
- let qc = Arc::new(q);
31
- let qc1 = Arc::clone(&qc);
32
- let qc2 = Arc::clone(&qc);
33
-
34
thread::spawn(move || {
35
- for val in &qc1.first_half {
+ for val in q.first_half {
36
println!("sending {:?}", val);
37
- tx.send(*val).unwrap();
+ tx.send(val).unwrap();
38
thread::sleep(Duration::from_secs(1));
39
40
});
41
42
43
- for val in &qc2.second_half {
+ for val in q.second_half {
44
45
46
47
48
0 commit comments