2011-07-29 22:09:25 -07:00
|
|
|
use std;
|
2011-08-15 16:38:23 -07:00
|
|
|
import std::vec;
|
2011-07-29 22:09:25 -07:00
|
|
|
import std::task;
|
|
|
|
import std::uint;
|
|
|
|
import std::str;
|
|
|
|
|
|
|
|
fn f(n: uint) {
|
|
|
|
let i = 0u;
|
2011-08-19 15:16:48 -07:00
|
|
|
while i < n { let thunk = g; task::join_id(task::spawn(thunk)); i += 1u; }
|
2011-07-29 22:09:25 -07:00
|
|
|
}
|
|
|
|
|
2011-08-19 15:16:48 -07:00
|
|
|
fn g() { }
|
2011-07-29 22:09:25 -07:00
|
|
|
|
2011-08-13 22:34:16 -07:00
|
|
|
fn main(args: [str]) {
|
2011-07-29 22:09:25 -07:00
|
|
|
|
2011-08-19 15:16:48 -07:00
|
|
|
let n =
|
|
|
|
if vec::len(args) < 2u {
|
|
|
|
10u
|
|
|
|
} else { uint::parse_buf(str::bytes(args[1]), 10u) };
|
2011-07-29 22:09:25 -07:00
|
|
|
let i = 0u;
|
2011-08-19 15:16:48 -07:00
|
|
|
while i < n { task::spawn(bind f(n)); i += 1u; }
|
2011-08-15 11:34:12 -07:00
|
|
|
}
|