Blocks until the vCPU thread has acknowledged the signal. It retries to send the signal every 10ms. Times out after 1000ms. This is the counterpart of [`Self::signal_thread`].
(&self)
| 803 | /// |
| 804 | /// This is the counterpart of [`Self::signal_thread`]. |
| 805 | fn wait_until_signal_acknowledged(&self) -> Result<()> { |
| 806 | if let Some(_handle) = self.handle.as_ref() { |
| 807 | let mut count = 0; |
| 808 | loop { |
| 809 | if self.vcpu_run_interrupted.load(Ordering::SeqCst) { |
| 810 | return Ok(()); |
| 811 | } |
| 812 | // This is more effective than thread::yield_now() at |
| 813 | // avoiding a priority inversion with the vCPU thread |
| 814 | thread::sleep(std::time::Duration::from_millis(1)); |
| 815 | count += 1; |
| 816 | if count >= 1000 { |
| 817 | return Err(Error::SignalAcknowledgeTimeout); |
| 818 | } else if count % 10 == 0 { |
| 819 | warn!("vCPU thread did not respond in {count}ms to signal - retrying"); |
| 820 | self.signal_thread(); |
| 821 | } |
| 822 | } |
| 823 | } |
| 824 | Ok(()) |
| 825 | } |
| 826 | |
| 827 | fn join_thread(&mut self) -> Result<()> { |
| 828 | if let Some(handle) = self.handle.take() { |
no test coverage detected