2011-03-25 12:19:20 -07:00
|
|
|
// xfail-stage0
|
2011-05-03 18:13:51 -07:00
|
|
|
// xfail-stage1
|
|
|
|
// xfail-stage2
|
2011-04-19 13:35:49 -07:00
|
|
|
fn start(chan[int] c, int n) {
|
2010-08-24 21:06:56 -07:00
|
|
|
let int i = n;
|
|
|
|
|
|
|
|
while(i > 0) {
|
|
|
|
c <| 0;
|
|
|
|
i = i - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-19 13:35:49 -07:00
|
|
|
fn main() {
|
2010-08-24 21:06:56 -07:00
|
|
|
let port[int] p = port();
|
2010-09-07 18:01:35 -07:00
|
|
|
// Spawn a task that sends us back messages. The parent task
|
|
|
|
// is likely to terminate before the child completes, so from
|
|
|
|
// the child's point of view the receiver may die. We should
|
|
|
|
// drop messages on the floor in this case, and not crash!
|
2010-08-24 21:06:56 -07:00
|
|
|
auto child = spawn thread "child" start(chan(p), 10);
|
2011-05-26 18:17:13 -07:00
|
|
|
auto c; c <- p;
|
|
|
|
}
|