aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/lazychan.rs
blob: 77ab43944d0bc87ecc64decb4eef7a902697bb5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// xfail-stage0
// xfail-stage1
// xfail-stage2
// -*- rust -*-

fn main() {
  let port[int] p = port();
  auto c = chan(p);
  let int y;

  spawn child(c);
  y <- p;
  log "received 1";
  log y;
  assert (y == 10);

  spawn child(c);
  y <- p;
  log "received 2";
  log y;
  assert (y == 10);
}

fn child(chan[int] c) {
  c <| 10;
}