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;
#[no_mangle]
pub fn a_first_fn() {
for _x in 0..2000000000 {}
for _x in 0..2000000 {}
}
#[no_mangle]
pub fn b_second_fn() {
for _y in 0..1900000000 {}
for _y in 0..1900000 {}
}
fn main() {
let handle1 = thread::spawn(|| a_first_fn());
let handle2 = thread::spawn(|| b_second_fn());
handle1.join().unwrap();
handle2.join().unwrap();
coz::progress!();
for _n in 1..1000 {
let handle1 = thread::spawn(|| a_first_fn());
let handle2 = thread::spawn(|| b_second_fn());
handle1.join().unwrap();
handle2.join().unwrap();
coz::progress!();
}
}