aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/acyclic-unwind.rs
blob: b549cffeef6e279bc5a8bedd356d0db129585a14 (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
// -*- rust -*-

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

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

  // Signal parent that we've allocated an exterior.
  c <| 1;

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


io 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";
}