sleep to switch thread in USB thread saving image if user invoke cancel

This commit is contained in:
gb 2023-12-04 15:21:08 +08:00
parent db0a5b7db3
commit 9b10e91dba
1 changed files with 3 additions and 0 deletions

View File

@ -3635,6 +3635,9 @@ int hg_scanner::save_usb_data(std::shared_ptr<tiny_buffer> data)
int ret = SCANNER_ERR_OK;
unsigned int bytes = data->size();
if (user_cancel_)
std::this_thread::sleep_for(std::chrono::milliseconds(0)); // make CPU switch thread ...
usb_img_index_++;
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "USB packet(%04d) of picture with %u bytes(status: %d)\n", usb_img_index_, data->size(), data->get_image_statu());
if (dump_usb_path_.length()) //这两台设备不是jpg的图 所以不能直接处理