aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/acyclic-unwind.rs
blob: 617937738f44fd5d0ce9feb46d52b58ee08e351f (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
27
28
29
30
31
32
33
34
35
36
37
38
// xfail-stage0
// xfail-stage1
// xfail-stage2
// -*- rust -*-

fn f(chan[int] c)
{
  type t = tup(int,int,int);

  // Allocate a box.
  let @t x = @tup(1,2,3);

  // Signal parent that we've allocated a box.
  c <| 1;

  while (true) {
    // spin waiting for the parent to kill us.
    log "child waiting to die...";

    // while waiting to die, the messages we are
    // sending to the channel are never received
    // by the parent, therefore this test cases drops
    // messages on the floor
    c <| 1;
  }
}


fn main() {
  let port[int] p = port();
  spawn f(chan(p));
  let int i;

  // synchronize on event from child.
  i <- p;

  log "parent exiting, killing child";
}