2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2013-08-06 16:32:30 -05:00
|
|
|
// xfail-test linked failure
|
2013-05-20 19:07:24 -05:00
|
|
|
extern mod extra;
|
2011-09-16 12:49:41 -05:00
|
|
|
|
2013-05-24 21:35:29 -05:00
|
|
|
use std::comm;
|
|
|
|
use std::task;
|
|
|
|
|
2012-01-04 23:14:53 -06:00
|
|
|
fn die() {
|
2013-02-11 21:26:38 -06:00
|
|
|
fail!();
|
2011-09-16 12:49:41 -05:00
|
|
|
}
|
|
|
|
|
2012-01-04 23:14:53 -06:00
|
|
|
fn iloop() {
|
2012-06-30 18:19:07 -05:00
|
|
|
task::spawn(|| die() );
|
2013-02-02 05:10:12 -06:00
|
|
|
let (p, c) = comm::stream::<()>();
|
2012-03-09 18:11:56 -06:00
|
|
|
loop {
|
2013-08-16 14:49:40 -05:00
|
|
|
// Sending and receiving here because these actions deschedule,
|
2013-01-29 01:54:39 -06:00
|
|
|
// at which point our child can kill us.
|
|
|
|
c.send(());
|
|
|
|
p.recv();
|
|
|
|
// The above comment no longer makes sense but I'm
|
|
|
|
// reluctant to remove a linked failure test case.
|
2013-08-16 14:49:40 -05:00
|
|
|
task::deschedule();
|
2011-09-16 12:49:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2013-08-03 11:45:23 -05:00
|
|
|
for _ in range(0u, 16u) {
|
2012-07-23 14:53:18 -05:00
|
|
|
task::spawn_unlinked(|| iloop() );
|
2011-10-21 07:12:12 -05:00
|
|
|
}
|
2012-07-23 14:53:18 -05:00
|
|
|
}
|