(id: usize)
| 47 | } |
| 48 | |
| 49 | pub fn thread_fn(id: usize) -> ! { |
| 50 | // println!("Thread[{}] init.", id); |
| 51 | let peer_id: usize = id ^ 1; |
| 52 | for iter in 0..N { |
| 53 | if iter % 10 == 0 { |
| 54 | println!("[{}] it={}", id, iter); |
| 55 | } |
| 56 | peterson_enter_critical(id, peer_id); |
| 57 | critical_test_enter(); |
| 58 | for _ in 0..3 { |
| 59 | critical_test_claim(); |
| 60 | sleep(2); |
| 61 | } |
| 62 | critical_test_exit(); |
| 63 | peterson_exit_critical(id); |
| 64 | } |
| 65 | exit(0) |
| 66 | } |
| 67 | |
| 68 | #[no_mangle] |
| 69 | pub fn main() -> i32 { |
nothing calls this directly
no test coverage detected