Skip to content

Instantly share code, notes, and snippets.

@gterzian
Created August 7, 2018 21:16
Show Gist options
  • Save gterzian/e59537b5f4ab9bacb74199e3d68edf86 to your computer and use it in GitHub Desktop.
Save gterzian/e59537b5f4ab9bacb74199e3d68edf86 to your computer and use it in GitHub Desktop.
// Cloning merge_chan first, then moving it.
// This move ensures that when square_workers drop,
// and the workers quit their loop,
// all merge_chan senders drop as well,
// triggerign the quit of the loop in the "merge" stage...
let mut square_workers: VecDeque<Sender<PipelineMsg>> = vec![square(merge_chan.clone()),
square(merge_chan)]
.into_iter()
.collect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment