add time-out control for APP image fetching in scan_done
This commit is contained in:
parent
c5b71eb78f
commit
e7cd546afb
|
@ -807,8 +807,25 @@ void scanner::scan_done(void)
|
|||
{
|
||||
std::string msg(scan_msg_);
|
||||
|
||||
while (images_.count())
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
// avoid APP do not fetch image ... - 2023-11-30
|
||||
if (err_ != SCANNER_ERR_USER_CANCELED)
|
||||
{
|
||||
int cnt = images_.count(),
|
||||
wait_total = 1000,
|
||||
wait_unit = 5,
|
||||
wait = 0;
|
||||
|
||||
while (cnt)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(wait_unit));
|
||||
wait++;
|
||||
if (wait >= wait_total / wait_unit)
|
||||
break;
|
||||
else if (cnt != images_.count())
|
||||
wait = 0;
|
||||
cnt = images_.count();
|
||||
}
|
||||
}
|
||||
|
||||
if (indicator_)
|
||||
indicator_->notify_scan_over(&msg[0], err_ != SCANNER_ERR_OK);
|
||||
|
|
Loading…
Reference in New Issue