Skip to content

Instantly share code, notes, and snippets.

@lilyball
Created December 4, 2013 06:47
Show Gist options
  • Save lilyball/7783359 to your computer and use it in GitHub Desktop.
Save lilyball/7783359 to your computer and use it in GitHub Desktop.
fn worksShared() {
let (port, chan): (Port<int>, Chan<int>) = stream();
let shared = std::comm::SharedChan::new(chan);
for i in range(0, 100) {
let chan = shared.clone();
do spawn {
chan.send(i);
}
}
while port.peek() {
println(port.recv().to_str());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment