Skip to content

Instantly share code, notes, and snippets.

@selfup
Created March 12, 2017 20:22
Show Gist options
  • Save selfup/027b767ae024115a7ad32c99df9be969 to your computer and use it in GitHub Desktop.
Save selfup/027b767ae024115a7ad32c99df9be969 to your computer and use it in GitHub Desktop.
fn cluster(trimmed: i64) {
let range: Vec<i64> = (0..trimmed + 1).collect();
range.par_iter()
.map(|i| thread::spawn(move || run(i.to_le())))
.map(|runner| runner.join());
}
@selfup
Copy link
Author

selfup commented Mar 12, 2017

Back to the original way

    let mut runners = vec![];

    for i in 0..trimmed + 1 {
        let runner = thread::spawn(move || run(i));
        runners.push(runner);
    }

    for runner in runners {
        &runner.join();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment