Skip to content

Commit

Permalink
Use threads to run days
Browse files Browse the repository at this point in the history
  • Loading branch information
DL-APA committed Dec 7, 2022
1 parent 8e082e5 commit 4a3e5c2
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions aoc2022/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
use std::thread;

mod d1;
mod d2;
mod d3;
mod d4;
mod d5;
mod d6;

fn main() {
d1::run();
d2::run();
d3::run();
d4::run();
d5::run();
d6::run();
let mut handles = vec![];

for i in 1..6 {
let handle = thread::spawn(move || match i {
1 => d1::run(),
2 => d2::run(),
3 => d3::run(),
4 => d4::run(),
5 => d5::run(),
6 => d6::run(),
_ => println!("No such day"),
});
handles.push(handle);
}

for handle in handles {
handle.join().unwrap();
}
}

0 comments on commit 4a3e5c2

Please sign in to comment.