try wait hw check config subprocess

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-03-27 22:56:48 +08:00
parent 679d3d9868
commit 947c7dbb97

View File

@ -3,7 +3,7 @@ use crate::{
hw, ImageFormat, HW_STRIDE_ALIGN, hw, ImageFormat, HW_STRIDE_ALIGN,
}; };
use hbb_common::{ use hbb_common::{
anyhow::{anyhow, Context}, anyhow::{allow_err, anyhow, Context},
bytes::Bytes, bytes::Bytes,
config::HwCodecConfig, config::HwCodecConfig,
get_time, lazy_static, log, get_time, lazy_static, log,
@ -352,7 +352,19 @@ pub fn check_config_process(force_reset: bool) {
let second = 3; let second = 3;
std::thread::sleep(std::time::Duration::from_secs(second)); std::thread::sleep(std::time::Duration::from_secs(second));
// kill: Different platforms have different results // kill: Different platforms have different results
child.kill().ok(); allow_err!(child.kill());
std::thread::sleep(std::time::Duration::from_millis(30));
match ps.try_wait() {
Ok(Some(status)) => log::info!("Check hwcodec config, exit with: {status}"),
Ok(None) => {
log::info!(
"Check hwcodec config, status not ready yet, let's really wait"
);
let res = child.wait();
log::info!("Check hwcodec config, wait result: {res:?}");
}
Err(e) => println!("Check hwcodec config, error attempting to wait: {e}"),
}
HwCodecConfig::refresh(); HwCodecConfig::refresh();
} }
} }