add lock on do_stop command

This commit is contained in:
gb 2023-12-04 11:50:39 +08:00
parent d5325e9a4c
commit b78afdc9a0
2 changed files with 2 additions and 1 deletions

View File

@ -4117,7 +4117,7 @@ int hg_scanner::wait_one_image_from_start(bool& handled)
int ret = SCANNER_ERR_OK;
handled = false;
if (!async_io_) // non-callback
if (!async_io_) // non-callback, async do this in upper level
{
while (is_running() != THREAD_RUNNING_IDLE)
{

View File

@ -1642,6 +1642,7 @@ int hg_scanner_239::do_start(void)
int hg_scanner_239::do_stop(void)
{
int ret = SCANNER_ERR_OK;
std::lock_guard<std::mutex> lock(io_lock_);
ret = write_command(setting3399::SC_STOP);
io_->set_timeout(500);