send exit messages to threads
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0d813cfb6f
commit
19f3a6daf5
@ -52,8 +52,14 @@ fn main() -> Result<(), std::io::Error> {
|
|||||||
for (x, y, p) in image.enumerate_pixels() {
|
for (x, y, p) in image.enumerate_pixels() {
|
||||||
let _ = sender.send(Message::Pixel(x, y, p.clone()));
|
let _ = sender.send(Message::Pixel(x, y, p.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(0..16).for_each(|_| {
|
||||||
|
let _ = sender.send(Message::Exit);
|
||||||
|
});
|
||||||
|
|
||||||
for thread in handles {
|
for thread in handles {
|
||||||
let _ = thread.join();
|
let _ = thread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user