移除read_int线程

This commit is contained in:
13038267101 2023-04-28 16:12:56 +08:00
parent d27c3c1149
commit 9eee1374c4
3 changed files with 42 additions and 47 deletions

View File

@ -223,8 +223,8 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
wait_img_.set_debug_info("Image");
wait_usb_result_.set_debug_info("start");
wait_devsislock_.set_debug_info("Devsislock");
wait_read_int.set_debug_info("read_int");
thread_read_int_.reset(new std::thread(&hg_scanner::thread_read_int, this));
//wait_read_int.set_debug_info("read_int");
//thread_read_int_.reset(new std::thread(&hg_scanner::thread_read_int, this));
thread_usb_read_.reset(new std::thread(&hg_scanner::thread_handle_usb, this));
thread_img_handle_.reset(new std::thread(&hg_scanner::thread_image_handle, this));
@ -239,8 +239,8 @@ hg_scanner::~hg_scanner()
close(true);
hg_version_free_handle();
if (thread_read_int_.get() && thread_read_int_->joinable())
thread_read_int_->join();
//if (thread_read_int_.get() && thread_read_int_->joinable())
// thread_read_int_->join();
if (thread_usb_read_.get() && thread_usb_read_->joinable())
thread_usb_read_->join();
if (thread_img_handle_.get() && thread_img_handle_->joinable())
@ -3024,7 +3024,7 @@ int hg_scanner::close(bool force)
wait_usb_.notify();
wait_img_.notify();
wait_devsislock_.notify();
wait_read_int.notify();
//wait_read_int.notify();
if(!scan_life_)
{
std::lock_guard<std::mutex> lock(io_lock_);

View File

@ -170,12 +170,12 @@ hg_scanner_239::hg_scanner_239(const char* dev_name, int pid,usb_io* io) : hg_sc
init_settings((jsontext4 + jsontext5).c_str());
}
hg_version_init_handle();
init_version();
#ifdef OEM_HUAGAO
wait_devsislock_.notify();
#endif
wait_read_int.notify();
//wait_read_int.notify();
}
hg_scanner_239::~hg_scanner_239()
{
@ -729,7 +729,7 @@ int hg_scanner_239::discard_all_images(void)
}
if (is_read_int)
{
init_version();
//init_version();
}
if (pre_int)

View File

@ -90,7 +90,8 @@ hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_sc
else
init_settings((jsontext3 + jsontext4).c_str());
}
wait_read_int.notify();
//wait_read_int.notify();
initdevice();
}
hg_scanner_300::~hg_scanner_300()
{}
@ -287,7 +288,7 @@ int hg_scanner_300::discard_all_images(void)
if (is_read_int)
{
initdevice();
//initdevice();
}
return SCANNER_ERR_OK;
}
@ -714,55 +715,49 @@ int hg_scanner_300::initdevice()
int val = 0,
ret = SCANNER_ERR_OK;
int cnt = 0;
while (!val)
{
cnt++;
ret = get_scan_is_sleep(val);
if (!val && ret == SCANNER_ERR_OK)
{
status_ = SCANNER_ERR_DEVICE_SLEEPING;
}
if (cnt > 5)
{
break;
}
this_thread::sleep_for(chrono::milliseconds(800));
//set_kernelsnap_ver();
}
string fw = get_firmware_version();
if (!fw.empty())
{
if (fw.substr(4, 6) == "230303")
{
ret = get_scan_is_sleep(val);
if (!val && ret == SCANNER_ERR_OK)
{
is_devs_sleep_ = status_ = SCANNER_ERR_DEVICE_SLEEPING;
}
if (status_ != SCANNER_ERR_DEVICE_SLEEPING)
{
string fw = get_firmware_version();
if (!fw.empty())
{
if (fw.substr(4, 6) == "230303")
{
#ifndef WIN32
#ifdef OEM_HANWANG
#ifdef OEM_HANWANG
string libname = "libhwdriver.so";
#elif defined(OEM_LISICHENG)
#elif defined(OEM_LISICHENG)
string libname = "liblscdriver.so";
#elif defined(OEM_CANGTIAN)
#elif defined(OEM_CANGTIAN)
string libname = "libctsdriver.so";
#elif defined(OEM_ZHONGJING)
#elif defined(OEM_ZHONGJING)
string libname = "libzjdriver.so";
#elif defined(OEM_ZIGUANG)
#elif defined(OEM_ZIGUANG)
string libname = "libzgdriver.so";
#else
string libname = "libhgdriver.so";
#endif
#else
string libname = "scanner.dll";
string libname = "libhgdriver.so";
#endif
#else
string libname = "scanner.dll";
#endif
string scanner_path = hg_log::get_module_full_path(libname.c_str());
scanner_path = scanner_path.substr(0, scanner_path.size() - libname.size());
scanner_path += "update.zip";
set_firmware_upgrade(scanner_path);
string scanner_path = hg_log::get_module_full_path(libname.c_str());
scanner_path = scanner_path.substr(0, scanner_path.size() - libname.size());
scanner_path += "update.zip";
set_firmware_upgrade(scanner_path);
}
}
}
set_kernelsnap_ver();
is_devs_sleep_ = true; //客户提前点击设置这边固件版本号 还没有做判断的
if (status_ != SCANNER_ERR_DEVICE_SLEEPING)
{
set_kernelsnap_ver();
is_devs_sleep_ = false; // 睡眠唤醒 客户提前点击设置这边固件版本号 还没有做判断的
}
return SCANNER_ERR_OK;
}
void hg_scanner_300::writedown_image_configuration(void)