Changed to loop.

This commit is contained in:
Emery Berger 2022-08-12 21:15:19 -04:00
parent ecf5b50b0d
commit d35d966f37

View File

@ -3,19 +3,20 @@ use coz;
use std::thread; use std::thread;
#[no_mangle] #[no_mangle]
pub fn a_first_fn() { pub fn a_first_fn() {
for _x in 0..2000000000 {} for _x in 0..2000000 {}
} }
#[no_mangle] #[no_mangle]
pub fn b_second_fn() { pub fn b_second_fn() {
for _y in 0..1900000000 {} for _y in 0..1900000 {}
} }
fn main() { fn main() {
let handle1 = thread::spawn(|| a_first_fn()); for _n in 1..1000 {
let handle2 = thread::spawn(|| b_second_fn()); let handle1 = thread::spawn(|| a_first_fn());
let handle2 = thread::spawn(|| b_second_fn());
handle1.join().unwrap(); handle1.join().unwrap();
handle2.join().unwrap(); handle2.join().unwrap();
coz::progress!(); coz::progress!();
}
} }