Merge pull request #1903 from mo8it/threads3

Remove unneeded Arc
pull/1905/head^2
liv 3 months ago committed by GitHub
commit 9c6f56b836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,22 +27,18 @@ impl Queue {
}
fn send_tx(q: Queue, tx: mpsc::Sender<u32>) -> () {
let qc = Arc::new(q);
let qc1 = Arc::clone(&qc);
let qc2 = Arc::clone(&qc);
thread::spawn(move || {
for val in &qc1.first_half {
for val in q.first_half {
println!("sending {:?}", val);
tx.send(*val).unwrap();
tx.send(val).unwrap();
thread::sleep(Duration::from_secs(1));
}
});
thread::spawn(move || {
for val in &qc2.second_half {
for val in q.second_half {
println!("sending {:?}", val);
tx.send(*val).unwrap();
tx.send(val).unwrap();
thread::sleep(Duration::from_secs(1));
}
});

Loading…
Cancel
Save