MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / drop

Method drop

vmm/src/device_manager.rs:5784–5804  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

5782
5783impl Drop for DeviceManager {
5784 fn drop(&mut self) {
5785 // Explicitly clear the regions owned by this device to ensure
5786 // that they are dropped and unmapped before the container is cleared.
5787 // See eject_device() for the device hot-unplug equivalent.
5788 self.mmio_regions.lock().unwrap().clear();
5789
5790 // Wake up the DeviceManager threads (mainly virtio device workers),
5791 // to avoid deadlock on waiting for paused/parked worker threads.
5792 if let Err(e) = self.resume() {
5793 error!("Error resuming DeviceManager: {e:?}");
5794 }
5795
5796 for handle in self.virtio_devices.drain(..) {
5797 handle.virtio_device.lock().unwrap().shutdown();
5798 }
5799
5800 if let Some(termios) = *self.original_termios_opt.lock().unwrap() {
5801 // SAFETY: FFI call
5802 let _ = unsafe { tcsetattr(stdout().lock().as_raw_fd(), TCSANOW, &termios) };
5803 }
5804 }
5805}
5806
5807#[cfg(test)]

Callers

nothing calls this directly

Calls 4

clearMethod · 0.80
resumeMethod · 0.45
shutdownMethod · 0.45
as_raw_fdMethod · 0.45

Tested by

no test coverage detected