Hi all,
I am following a parallel programming course in scala. I want to reproduce a similar example as given in scala.
class HelloThreads extends Thread {
override def run() {
println("Hello")
println("world")
}
}
def main() {
val t = HelloThread()
val s = HelloThread()
t.start()
s.start()
t.join()
s.join()
}
I was able to crate thread and able to print "hello world" from rust by
use std::thread;
fn main() {
let thread1 = thread::spawn(|| {println!("Hello");
println!("World");
});
let thread2 = thread::spawn(|| {println!("Hello 2");
println!("World 2");
});
thread1.join().unwrap();
thread2.join().unwrap();
}
Is there a start
method in rust or that both start
and hold
are taken care by join
?