mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-17 02:54:26 +00:00
e4f7561bcd
The entire testsuite is converted to using info! rather than debug! because some depend on the code within the debug! being trans'd.
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
// 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.
|
|
|
|
// xfail-test
|
|
// This checks that preemption works.
|
|
|
|
// note: halfway done porting to modern rust
|
|
extern mod extra;
|
|
|
|
use std::comm;
|
|
use extra::comm;
|
|
|
|
fn starve_main(alive: Port<int>) {
|
|
info!("signalling main");
|
|
alive.recv();
|
|
info!("starving main");
|
|
let mut i: int = 0;
|
|
loop { i += 1; }
|
|
}
|
|
|
|
pub fn main() {
|
|
let (port, chan) = stream();
|
|
|
|
info!("main started");
|
|
do spawn {
|
|
starve_main(port);
|
|
};
|
|
let mut i: int = 0;
|
|
info!("main waiting for alive signal");
|
|
chan.send(i);
|
|
info!("main got alive signal");
|
|
while i < 50 { info!("main iterated"); i += 1; }
|
|
info!("main completed");
|
|
}
|