(&mut self)
| 2047 | } |
| 2048 | |
| 2049 | pub fn shutdown(&mut self) -> Result<()> { |
| 2050 | let new_state = VmState::Shutdown; |
| 2051 | |
| 2052 | self.state.valid_transition(new_state)?; |
| 2053 | |
| 2054 | // Wake up the DeviceManager threads so they will get terminated cleanly |
| 2055 | self.device_manager |
| 2056 | .lock() |
| 2057 | .unwrap() |
| 2058 | .resume() |
| 2059 | .map_err(Error::Resume)?; |
| 2060 | |
| 2061 | self.cpu_manager |
| 2062 | .lock() |
| 2063 | .unwrap() |
| 2064 | .shutdown() |
| 2065 | .map_err(Error::CpuManager)?; |
| 2066 | |
| 2067 | // Wait for all the threads to finish |
| 2068 | for thread in self.threads.drain(..) { |
| 2069 | thread.join().map_err(Error::ThreadCleanup)?; |
| 2070 | } |
| 2071 | self.state = new_state; |
| 2072 | |
| 2073 | Ok(()) |
| 2074 | } |
| 2075 | |
| 2076 | pub fn resize( |
| 2077 | &mut self, |
no test coverage detected