Skip to content

Commit 2ea9cee

Browse files
04101857
1 parent d7fcfd8 commit 2ea9cee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

exercises/threads/threads3.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Execute `rustlings hint threads3` or use the `hint` watch subcommand for a
44
// hint.
55

6-
// I AM NOT DONE
7-
86
use std::sync::mpsc;
97
use std::sync::Arc;
108
use std::thread;
@@ -31,10 +29,12 @@ fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
3129
let qc1 = Arc::clone(&qc);
3230
let qc2 = Arc::clone(&qc);
3331

32+
let tx1 = tx.clone();
33+
3434
thread::spawn(move || {
3535
for val in &qc1.first_half {
3636
println!("sending {:?}", val);
37-
tx.send(*val).unwrap();
37+
tx1.send(*val).unwrap();
3838
thread::sleep(Duration::from_secs(1));
3939
}
4040
});

0 commit comments

Comments
 (0)