Skip to content

Instantly share code, notes, and snippets.

@eholk
Created July 11, 2011 21:59
Show Gist options
  • Select an option

  • Save eholk/1076902 to your computer and use it in GitHub Desktop.

Select an option

Save eholk/1076902 to your computer and use it in GitHub Desktop.
fn main() {
fn echo[T](chan[T] c, chan[chan[T]] oc) {
let port[T] p = port();
oc <| chan(p);
auto x;
p |> x;
c <| x;
}
auto p = port[int]();
auto p2 = port[chan[int]]();
spawn echo(chan(p), chan(p2));
auto c;
auto x;
p2 |> c;
c <| 42;
p |> x;
log x;
assert(x == 42);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment