(argc: usize, argv: &[&str])
| 34 | |
| 35 | #[no_mangle] |
| 36 | pub fn main(argc: usize, argv: &[&str]) -> i32 { |
| 37 | let mut thread_count = THREAD_COUNT_DEFAULT; |
| 38 | let mut per_thread = PER_THREAD_DEFAULT; |
| 39 | if argc >= 2 { |
| 40 | thread_count = argv[1].parse().unwrap(); |
| 41 | if argc >= 3 { |
| 42 | per_thread = argv[2].parse().unwrap(); |
| 43 | } |
| 44 | } |
| 45 | unsafe { PER_THREAD = per_thread; } |
| 46 | |
| 47 | let start = get_time(); |
| 48 | assert_eq!(mutex_blocking_create(), 0); |
| 49 | let mut v = Vec::new(); |
| 50 | for _ in 0..thread_count { |
| 51 | v.push(thread_create(f as usize, 0) as usize); |
| 52 | } |
| 53 | for tid in v.into_iter() { |
| 54 | waittid(tid); |
| 55 | } |
| 56 | println!("time cost is {}ms", get_time() - start); |
| 57 | assert_eq!(unsafe { A }, unsafe { PER_THREAD } * thread_count); |
| 58 | 0 |
| 59 | } |
nothing calls this directly
no test coverage detected