March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
15
Task/Concurrent-computing/Rust/concurrent-computing.rust
Normal file
15
Task/Concurrent-computing/Rust/concurrent-computing.rust
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use std::io::timer::sleep;
|
||||
use std::rand::{rng, Rng};
|
||||
|
||||
fn main() {
|
||||
let mut random = rng();
|
||||
for word in "Enjoy Rosetta Code".words() {
|
||||
let local_word = word.to_owned();
|
||||
let snooze_time = random.gen_range::<u64>(0, 1000);
|
||||
|
||||
spawn(proc() {
|
||||
sleep(snooze_time);
|
||||
println!("{}", local_word);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue