mirror of
https://github.com/plasma-umass/coz.git
synced 2024-09-11 04:55:25 +03:00
Changed to loop.
This commit is contained in:
parent
ecf5b50b0d
commit
d35d966f37
@ -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!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user