2011-10-20 20:34:04 -07:00
|
|
|
fn f(&&n: uint) {
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut i = 0u;
|
2011-08-20 13:02:26 -07:00
|
|
|
while i < n {
|
2012-02-18 16:34:42 -08:00
|
|
|
task::try {|| g() };
|
2011-09-02 15:34:58 -07:00
|
|
|
i += 1u;
|
|
|
|
}
|
2011-07-29 22:09:25 -07:00
|
|
|
}
|
|
|
|
|
2012-01-06 22:02:05 -08:00
|
|
|
fn g() { }
|
2011-07-29 22:09:25 -07:00
|
|
|
|
2011-09-02 15:34:58 -07:00
|
|
|
fn main(args: [str]) {
|
2011-08-19 15:16:48 -07:00
|
|
|
let n =
|
|
|
|
if vec::len(args) < 2u {
|
|
|
|
10u
|
2012-02-22 13:18:15 +01:00
|
|
|
} else { option::get(uint::parse_buf(str::bytes(args[1]), 10u)) };
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut i = 0u;
|
2012-01-06 20:55:56 -08:00
|
|
|
while i < n { task::spawn {|| f(n); }; i += 1u; }
|
2011-08-15 11:34:12 -07:00
|
|
|
}
|