()
| 464 | |
| 465 | #[test] |
| 466 | fn test_barrier_async() { |
| 467 | let q = Queue::create("", QueueAttribute::Concurrent); |
| 468 | let num = Arc::new(Mutex::new(0)); |
| 469 | |
| 470 | async_increment(&q, &num); |
| 471 | async_increment(&q, &num); |
| 472 | |
| 473 | let num2 = num.clone(); |
| 474 | q.barrier_async(move || { |
| 475 | let mut num = num2.lock().unwrap(); |
| 476 | if *num == 2 { |
| 477 | *num = 10; |
| 478 | } |
| 479 | }); |
| 480 | |
| 481 | async_increment(&q, &num); |
| 482 | async_increment(&q, &num); |
| 483 | |
| 484 | q.barrier_sync(|| ()); |
| 485 | assert_eq!(*num.lock().unwrap(), 12); |
| 486 | } |
| 487 | |
| 488 | #[test] |
| 489 | fn test_suspend() { |
nothing calls this directly
no test coverage detected