Last active
August 7, 2018 21:58
-
-
Save gterzian/d73edbff1e3dc796d6b2421e97411cf7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Results chan, to get the final merged results to the main thread | |
let (results_chan, results_port) = channel(); | |
// Gen chan, to get generated numbers from the "generator". | |
let (gen_chan, gen_port) = channel(); | |
// Share the sender of the results chan to the merge component. | |
let merge_chan = merge(results_chan); | |
// Start the workers, each worker receives a clone of the "merge chan sender". | |
let mut square_workers: VecDeque<Sender<PipelineMsg>> = vec![square(merge_chan.clone()), | |
square(merge_chan.clone())] | |
.into_iter() | |
.collect(); | |
// Start the generator, passing along the "gen chan sender" | |
generate(gen_chan); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment