2011-09-23 12:30:16 -07:00
|
|
|
// xfail-win32
|
2011-09-16 10:49:41 -07:00
|
|
|
use std;
|
2011-12-13 16:25:51 -08:00
|
|
|
import task;
|
|
|
|
import comm;
|
|
|
|
import uint;
|
2011-09-16 10:49:41 -07:00
|
|
|
|
2012-01-04 21:14:53 -08:00
|
|
|
fn die() {
|
2011-09-16 10:49:41 -07:00
|
|
|
fail;
|
|
|
|
}
|
|
|
|
|
2012-01-04 21:14:53 -08:00
|
|
|
fn iloop() {
|
2012-06-30 16:19:07 -07:00
|
|
|
task::spawn(|| die() );
|
2011-09-16 10:49:41 -07:00
|
|
|
let p = comm::port::<()>();
|
|
|
|
let c = comm::chan(p);
|
2012-03-09 16:11:56 -08:00
|
|
|
loop {
|
2011-12-01 20:36:03 -08:00
|
|
|
// Sending and receiving here because these actions yield,
|
|
|
|
// at which point our child can kill us
|
2011-09-16 10:49:41 -07:00
|
|
|
comm::send(c, ());
|
2011-12-01 20:36:03 -08:00
|
|
|
comm::recv(p);
|
2011-09-16 10:49:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-30 16:19:07 -07:00
|
|
|
for uint::range(0u, 16u) |_i| {
|
2012-04-05 14:09:32 -07:00
|
|
|
let builder = task::builder();
|
2012-02-18 16:34:42 -08:00
|
|
|
task::unsupervise(builder);
|
2012-06-30 16:19:07 -07:00
|
|
|
task::run(builder, || iloop() );
|
2011-10-21 14:12:12 +02:00
|
|
|
}
|
2011-09-16 10:49:41 -07:00
|
|
|
}
|