(&mut self)
| 2635 | } |
| 2636 | |
| 2637 | fn resume(&mut self) -> std::result::Result<(), MigratableError> { |
| 2638 | // Ensure that vCPUs keep running after being unpark() in |
| 2639 | // their run vCPU loop. |
| 2640 | self.vcpus_pause_signalled.store(false, Ordering::SeqCst); |
| 2641 | |
| 2642 | let vcpu_states = self.vcpu_states.lock().unwrap(); |
| 2643 | |
| 2644 | // Unpark all the vCPU threads. |
| 2645 | // Step 1/2: signal each thread |
| 2646 | { |
| 2647 | for state in vcpu_states.iter() { |
| 2648 | state.unpark_thread(); |
| 2649 | } |
| 2650 | } |
| 2651 | // Step 2/2: wait for state ACK |
| 2652 | { |
| 2653 | for state in vcpu_states.iter() { |
| 2654 | // wait for vCPU to update state |
| 2655 | while state.paused.load(Ordering::SeqCst) { |
| 2656 | // To avoid a priority inversion with the vCPU thread |
| 2657 | thread::sleep(std::time::Duration::from_millis(1)); |
| 2658 | } |
| 2659 | } |
| 2660 | } |
| 2661 | Ok(()) |
| 2662 | } |
| 2663 | } |
| 2664 | |
| 2665 | impl Snapshottable for CpuManager { |
nothing calls this directly
no test coverage detected