2011-07-25 15:21:15 -07:00
|
|
|
// xfail-stage1
|
|
|
|
// xfail-stage2
|
|
|
|
// xfail-stage3
|
|
|
|
// This test fails when run with multiple threads
|
2011-07-12 15:27:17 -07:00
|
|
|
|
2011-08-06 10:07:39 -07:00
|
|
|
use std;
|
|
|
|
import std::comm;
|
|
|
|
|
|
|
|
fn start(pc: *u8, n: int) {
|
|
|
|
let c = comm::chan_from_unsafe_ptr();
|
2011-07-27 14:19:39 +02:00
|
|
|
let i: int = n;
|
2010-08-24 21:06:56 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
|
2011-08-06 10:07:39 -07:00
|
|
|
while i > 0 { c.send(0); i = i - 1; }
|
2010-08-24 21:06:56 -07:00
|
|
|
}
|
|
|
|
|
2011-04-19 13:35:49 -07:00
|
|
|
fn main() {
|
2011-08-06 10:07:39 -07:00
|
|
|
let p = comm::mk_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!
|
2011-08-06 10:07:39 -07:00
|
|
|
let child = spawn start(p.mk_chan().unsafe_ptr(), 10);
|
2011-07-27 14:19:39 +02:00
|
|
|
let c;
|
2011-08-06 10:07:39 -07:00
|
|
|
let pc = p.recv();
|
|
|
|
c = chan::chan_from_unsafe_ptr();
|
2011-07-27 14:19:39 +02:00
|
|
|
}
|