()
| 487 | |
| 488 | #[test] |
| 489 | fn test_suspend() { |
| 490 | let q = Queue::create("", QueueAttribute::Serial); |
| 491 | let num = Arc::new(Mutex::new(0)); |
| 492 | |
| 493 | // Suspend the queue and then dispatch some work to it |
| 494 | let guard = q.suspend(); |
| 495 | async_increment(&q, &num); |
| 496 | |
| 497 | // Sleep and ensure the work doesn't occur |
| 498 | ::std::thread::sleep(Duration::from_millis(5)); |
| 499 | assert_eq!(*num.lock().unwrap(), 0); |
| 500 | |
| 501 | // But ensure the work does complete after we resume |
| 502 | guard.resume(); |
| 503 | q.exec_sync(|| ()); |
| 504 | assert_eq!(*num.lock().unwrap(), 1); |
| 505 | } |
| 506 | } |
nothing calls this directly
no test coverage detected