Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created May 24, 2013 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaikKlein/5643027 to your computer and use it in GitHub Desktop.
Save MaikKlein/5643027 to your computer and use it in GitHub Desktop.
use core::comm::{stream, Chan,PortSet};
fn main() {
let p : PortSet<~str> = PortSet::new();
for 3.times {
let(receive,send) : (Port<~str>, Chan<~str>) = stream();
p.add(receive);
}
let chan = p.chan();
do spawn {
for 3.times {
let mut s = ~"";
s += p.recv();
println(s);
}
}
chan.send(~"Test1");
chan.send(~"Test2");
chan.send(~"Test3");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment