diff --git a/vhost-device-gpio/src/backend.rs b/vhost-device-gpio/src/backend.rs index e1e2815..42dbdfc 100644 --- a/vhost-device-gpio/src/backend.rs +++ b/vhost-device-gpio/src/backend.rs @@ -36,8 +36,6 @@ pub(crate) enum Error { DeviceDuplicate(u32), #[error("Failed while parsing to integer: {0:?}")] ParseFailure(ParseIntError), - #[error("Failed to join threads")] - FailedJoiningThreads, #[error("Could not open gpio device: {0}")] CouldNotOpenDevice(crate::gpio::Error), #[error("Could not create gpio controller: {0}")] @@ -227,7 +225,7 @@ fn start_backend(args: GpioArgs) -> Result<()> { } for handle in handles { - handle.join().map_err(|_| Error::FailedJoiningThreads)??; + handle.join().map_err(std::panic::resume_unwind).unwrap()?; } Ok(()) diff --git a/vhost-device-i2c/src/main.rs b/vhost-device-i2c/src/main.rs index eb838a0..5b2712f 100644 --- a/vhost-device-i2c/src/main.rs +++ b/vhost-device-i2c/src/main.rs @@ -39,8 +39,6 @@ pub(crate) enum Error { I2cFailure(i2c::Error), #[error("Failed while parsing to integer: {0:?}")] ParseFailure(ParseIntError), - #[error("Failed to join threads")] - FailedJoiningThreads, #[error("Could not create backend: {0}")] CouldNotCreateBackend(vhu_i2c::Error), #[error("Could not create daemon: {0}")] @@ -215,7 +213,7 @@ fn start_backend(args: I2cArgs) -> Result< } for handle in handles { - handle.join().map_err(|_| Error::FailedJoiningThreads)??; + handle.join().map_err(std::panic::resume_unwind).unwrap()?; } Ok(()) diff --git a/vhost-device-rng/src/main.rs b/vhost-device-rng/src/main.rs index b639aa5..a0e09a2 100644 --- a/vhost-device-rng/src/main.rs +++ b/vhost-device-rng/src/main.rs @@ -33,8 +33,6 @@ pub(crate) enum Error { InvalidPeriodInput(u128), #[error("Wrong socket count: {0}")] InvalidSocketCount(u32), - #[error("Threads can't be joined")] - FailedJoiningThreads, #[error("Could not create backend: {0}")] CouldNotCreateBackend(std::io::Error), #[error("Could not create daemon: {0}")] @@ -139,7 +137,7 @@ pub(crate) fn start_backend(config: VuRngConfig) -> Result<()> { } for handle in handles { - handle.join().map_err(|_| Error::FailedJoiningThreads)??; + handle.join().map_err(std::panic::resume_unwind).unwrap()?; } Ok(()) diff --git a/vhost-device-vsock/src/main.rs b/vhost-device-vsock/src/main.rs index 293779e..d8858df 100644 --- a/vhost-device-vsock/src/main.rs +++ b/vhost-device-vsock/src/main.rs @@ -281,7 +281,12 @@ pub(crate) fn start_backend_servers(configs: &[VsockConfig]) -> Result<(), Backe while !handles.is_empty() { let thread_id = receiver.recv().unwrap(); - handles.remove(&thread_id).unwrap().join().unwrap()?; + handles + .remove(&thread_id) + .unwrap() + .join() + .map_err(std::panic::resume_unwind) + .unwrap()?; } Ok(())