🐛 fix(main): 修复了在主线程中错误地使用线程的问题, 将部分功能移出线程以避免潜在的竞态条件

This commit is contained in:
conglinyizhi 2024-12-07 13:28:16 +08:00
parent 1dc82485bd
commit c2bb86a267
1 changed files with 8 additions and 10 deletions

View File

@ -77,7 +77,7 @@ fn main() {
println!("L8 Frame Draw use time: {:?}", duration);
})
.unwrap();
crossbeam::scope(|_| {
// 尝试将部分功能移出线程
let fltk_l_image =
RgbImage::new(l_data.as_raw(), w, h, ColorDepth::L8).unwrap();
camera_frame.set_image(Some(fltk_l_image));
@ -85,8 +85,6 @@ fn main() {
camera_frame.redraw();
let duration = start.elapsed();
println!("RGB8 Frame Draw use time: {:?}", duration);
})
.unwrap();
}
Err(e) => {
eprintln!("捕获错误: {}", e);