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-06-30 16:19:07 -07: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
|
|
|
|
2012-06-29 16:26:56 -07:00
|
|
|
fn main(args: ~[str]) {
|
2012-05-23 22:53:50 -07:00
|
|
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
2012-06-29 16:26:56 -07:00
|
|
|
~["", "400"]
|
2012-05-23 22:53:50 -07:00
|
|
|
} else if args.len() <= 1u {
|
2012-06-29 16:26:56 -07:00
|
|
|
~["", "10"]
|
2012-05-23 22:53:50 -07:00
|
|
|
} else {
|
|
|
|
args
|
|
|
|
};
|
|
|
|
let n = uint::from_str(args[1]).get();
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut i = 0u;
|
2012-06-30 16:19:07 -07:00
|
|
|
while i < n { task::spawn(|| f(n) ); i += 1u; }
|
2011-08-15 11:34:12 -07:00
|
|
|
}
|