Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,15 +1,13 @@
// rust 0.9
use std::thread;
fn main()
{
let args = std::os::args();
for arg in args.tail().iter()
{
let n = from_str::<u64>(*arg).unwrap();
do std::task::spawn
{
std::io::timer::sleep(n);
println!("{}", n);
}
}
fn sleepsort<I: Iterator<Item=u32>>(nums: I) {
let threads: Vec<_> = nums.map(|n|
thread::spawn(move || {
thread::sleep_ms(n);
println!("{}", n); })).collect();
for t in threads { t.join(); }
}
fn main() {
sleepsort(std::env::args().skip(1).map(|s| s.parse().unwrap()));
}