mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
devices: virtio-console: consume self in WorkerHandle::stop()
Clean up the unnecessary Option<> wrapping the worker thread. Resolves review comments from https://crrev.com/c/5798107 - no functional change intended. Change-Id: Iee3ca099a923da23fe48f10e8a33261180479c85 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5801012 Reviewed-by: Frederick Mayle <fmayle@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
93180de38a
commit
24c97b0596
2 changed files with 5 additions and 9 deletions
|
@ -108,7 +108,7 @@ impl ConsoleDevice {
|
|||
}
|
||||
|
||||
fn ensure_worker_stopped(&mut self) {
|
||||
if let Some(mut worker) = self.worker.take() {
|
||||
if let Some(worker) = self.worker.take() {
|
||||
let ports = worker.stop();
|
||||
for (worker_port, port) in ports.into_iter().zip(self.ports.iter_mut()) {
|
||||
worker_port.into_console_port(port);
|
||||
|
|
|
@ -299,7 +299,7 @@ impl Worker {
|
|||
}
|
||||
|
||||
pub struct WorkerHandle {
|
||||
worker_thread: Option<WorkerThread<Vec<WorkerPort>>>,
|
||||
worker_thread: WorkerThread<Vec<WorkerPort>>,
|
||||
worker_sender: mpsc::Sender<WorkerRequest>,
|
||||
worker_event: Event,
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ impl WorkerHandle {
|
|||
worker.ports
|
||||
});
|
||||
Ok(WorkerHandle {
|
||||
worker_thread: Some(worker_thread),
|
||||
worker_thread,
|
||||
worker_sender,
|
||||
worker_event,
|
||||
})
|
||||
|
@ -349,12 +349,8 @@ impl WorkerHandle {
|
|||
response_receiver.recv().context("mpsc::Receiver::recv")
|
||||
}
|
||||
|
||||
pub fn stop(&mut self) -> Vec<WorkerPort> {
|
||||
if let Some(worker_thread) = self.worker_thread.take() {
|
||||
worker_thread.stop()
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
pub fn stop(self) -> Vec<WorkerPort> {
|
||||
self.worker_thread.stop()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue