fix win cpu monitor run once

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-07-24 14:17:09 +08:00
parent dc0f21298e
commit 02456280d4
6 changed files with 30 additions and 23 deletions

View File

@@ -362,7 +362,10 @@ pub async fn start_server(is_server: bool) {
log::info!("DISPLAY={:?}", std::env::var("DISPLAY"));
log::info!("XAUTHORITY={:?}", std::env::var("XAUTHORITY"));
}
call_once_each_process();
#[cfg(feature = "hwcodec")]
scrap::hwcodec::check_config_process();
#[cfg(windows)]
hbb_common::platform::windows::start_cpu_performance_monitor();
if is_server {
crate::common::set_server_running(true);
@@ -523,16 +526,3 @@ async fn sync_and_watch_config_dir() {
}
log::warn!("skipped config sync");
}
fn call_once_each_process() {
use std::sync::Once;
static ONCE: Once = Once::new();
ONCE.call_once(|| {
#[cfg(feature = "hwcodec")]
scrap::hwcodec::check_config_process();
#[cfg(windows)]
unsafe {
hbb_common::platform::windows::start_cpu_performance_monitor();
}
})
}