summary refs log tree commit diff
path: root/src/test/run-pass/acyclic-unwind.rs
blob: 21fb2f174bd5934aa2544e807336eab121212b50 (plain)
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
39
// xfail-test
// -*- rust -*-

use std;
import comm;
import task;

fn f(c: comm::_chan<int>) {
    type t = {_0: int, _1: int, _2: int};

    // Allocate a box.
    let x: @t = @{_0: 1, _1: 2, _2: 3};

    // Signal parent that we've allocated a box.
    comm::send(c, 1);


    loop {
        // spin waiting for the parent to kill us.
        #debug("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
        comm::send(c, 1);
    }
}

fn main() {
    let p = comm::mk_port();
    task::_spawn(bind f(p.mk_chan()));
    let i: int;

    // synchronize on event from child.
    i = p.recv();

    #debug("parent exiting, killing child");
}