2011-07-29 22:09:25 -07:00
|
|
|
use std;
|
2011-08-11 16:36:20 -07:00
|
|
|
import std::ivec;
|
2011-07-29 22:09:25 -07:00
|
|
|
import std::task;
|
|
|
|
import std::uint;
|
|
|
|
import std::str;
|
|
|
|
|
|
|
|
fn f(n: uint) {
|
|
|
|
let i = 0u;
|
|
|
|
while i < n {
|
2011-08-13 16:03:28 -07:00
|
|
|
task::join_id(task::_spawn(bind g()));
|
2011-07-29 22:09:25 -07:00
|
|
|
i += 1u;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn g() {}
|
|
|
|
|
2011-08-13 22:34:16 -07:00
|
|
|
fn main(args: [str]) {
|
2011-07-29 22:09:25 -07:00
|
|
|
|
2011-08-13 22:34:16 -07:00
|
|
|
let n = if ivec::len(args) < 2u {
|
2011-07-29 22:09:25 -07:00
|
|
|
10u
|
|
|
|
} else {
|
2011-08-13 22:34:16 -07:00
|
|
|
uint::parse_buf(str::bytes(args.(1)), 10u)
|
2011-07-29 22:09:25 -07:00
|
|
|
};
|
|
|
|
let i = 0u;
|
|
|
|
while i < n {
|
2011-08-13 16:03:28 -07:00
|
|
|
task::_spawn(bind f(n));
|
2011-07-29 22:09:25 -07:00
|
|
|
i += 1u;
|
|
|
|
}
|
2011-08-15 11:34:12 -07:00
|
|
|
}
|