rust/src/test/run-pass/infinite-loops.rs

22 lines
420 B
Rust
Raw Normal View History

/*
A simple way to make sure threading works. This should use all the
CPU cycles an any machines that we're likely to see for a while.
*/
// xfail-stage1
// xfail-stage2
// xfail-stage3
use std;
import std::task::join;
2011-07-27 07:19:39 -05:00
fn loop(n: int) {
let t1: task;
let t2: task;
2011-07-27 07:19:39 -05:00
if n > 0 { t1 = spawn loop(n - 1); t2 = spawn loop(n - 1); }
2011-07-27 07:19:39 -05:00
while true { }
}
2011-07-27 07:19:39 -05:00
fn main() { let t: task = spawn loop(5); join(t); }