feat: completed solutions

This commit is contained in:
2026-03-23 03:36:33 -04:00
parent 2279bea6f1
commit f568c094cb
65 changed files with 424 additions and 139 deletions
+7 -2
View File
@@ -17,18 +17,23 @@ impl Queue {
fn send_tx(q: Queue, tx: mpsc::Sender<u32>) {
// TODO: We want to send `tx` to both threads. But currently, it is moved
// into the first thread. How could you solve this problem?
let transmission = tx.clone();
thread::spawn(move || {
for val in q.first_half {
println!("Sending {val:?}");
tx.send(val).unwrap();
transmission.send(val).unwrap();
thread::sleep(Duration::from_millis(250));
}
});
let transmission = tx.clone();
thread::spawn(move || {
for val in q.second_half {
println!("Sending {val:?}");
tx.send(val).unwrap();
transmission.send(val).unwrap();
thread::sleep(Duration::from_millis(250));
}
});