2011-06-20 19:19:50 -05:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
2011-08-31 06:22:58 -05:00
|
|
|
// xfail-test
|
2011-06-20 19:19:50 -05:00
|
|
|
|
|
|
|
use std;
|
2011-12-13 18:25:51 -06:00
|
|
|
import task::join;
|
2011-06-20 19:19:50 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn loop(n: int) {
|
|
|
|
let t1: task;
|
|
|
|
let t2: task;
|
2011-06-20 19:19:50 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
if n > 0 { t1 = spawn loop(n - 1); t2 = spawn loop(n - 1); }
|
2011-06-20 19:19:50 -05:00
|
|
|
|
|
|
|
|
2012-03-09 18:11:56 -06:00
|
|
|
loop { }
|
2011-06-20 19:19:50 -05:00
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
|
|
|
|
fn main() { let t: task = spawn loop(5); join(t); }
|