扫描线程未结束时关闭扫描仪,等待扫描线程结束

This commit is contained in:
gb 2022-10-10 18:07:57 +08:00
parent 585e1ef499
commit 8ac6cbbe6e
1 changed files with 2 additions and 0 deletions

View File

@ -2462,6 +2462,8 @@ int hg_scanner::close(bool force)
{ {
LOG_INFO(LOG_LEVEL_WARNING, "close scanner: USB thread or Image thread is still running.\n"); LOG_INFO(LOG_LEVEL_WARNING, "close scanner: USB thread or Image thread is still running.\n");
io_->close(); io_->close();
while (scan_life_)
std::this_thread::sleep_for(std::chrono::milliseconds(5));
io_->release(); io_->release();
io_ = NULL; io_ = NULL;
} }