修复读取不存在文件时的BUG

This commit is contained in:
gb 2023-12-29 16:25:39 +08:00
parent cc01febafb
commit 57eb55bcf3
4 changed files with 16 additions and 6 deletions

View File

@ -448,9 +448,12 @@ void async_usb_host::create_worker_threads(void)
{
thread_pump_task();
};
worker_.start(thread_p, "async_usb_host::thread_pump_task");
worker_.start(thread_w, "async_usb_host::thread_write_bulk");
worker_.start(thread_r, "async_usb_host::thread_read_bulk");
void(async_usb_host:: * p)(void) = &async_usb_host::thread_pump_task;
void(async_usb_host:: * r)(void) = &async_usb_host::thread_read_bulk;
void(async_usb_host:: * w)(void) = &async_usb_host::thread_write_bulk;
worker_.start(thread_p, "async_usb_host::thread_pump_task", *(void**)&p);
worker_.start(thread_w, "async_usb_host::thread_write_bulk", *(void**)&w);
worker_.start(thread_r, "async_usb_host::thread_read_bulk", *(void**)&r);
#else
thread_w_.reset(new std::thread(&async_usb_host::thread_write_bulk, this));
thread_r_.reset(new std::thread(&async_usb_host::thread_read_bulk, this));

View File

@ -656,7 +656,11 @@ int scanner_handler::file_transfer(const char* local_path, const char* remote_pa
}
}
else
{
utils::to_log(LOG_LEVEL_DEBUG, "Receive file - Roger result: %d\r\n", pack->data);
reply->release();
reply = nullptr;
}
cmd->trigger();
return reply;

View File

@ -182,7 +182,8 @@ usb_manager::usb_manager() : run_(true)
{
thread_notify_usb_event();
};
usb_notify_thread_.start(tf, "usb_manager::thread_notify_usb_event");
void(usb_manager:: * pnp)(void) = &usb_manager::thread_notify_usb_event;
usb_notify_thread_.start(tf, "usb_manager::thread_notify_usb_event", *(void**)&pnp);
#else
if (!usb_notify_thread_.get())
{
@ -279,7 +280,8 @@ void usb_manager::init_notify_thread()
{
thread_trigger_usb_event();
};
usb_monitor_thread_.start(tf, "usb_manager::thread_trigger_usb_event");
void(usb_manager:: * t)(void) = &usb_manager::thread_trigger_usb_event;
usb_monitor_thread_.start(tf, "usb_manager::thread_trigger_usb_event", *(void**)&t);
#else
if(!usb_monitor_thread_.get())
{

View File

@ -1958,6 +1958,7 @@ int shared_memory::write(const char* data, size_t len)
// safe_thread
safe_thread::safe_thread() : excep_que_("thread-exception")
{
excep_que_.enable_wait_log(false);
notify_thread_.reset(new std::thread(&safe_thread::thread_notify_exception, this));
}
safe_thread::~safe_thread()
@ -1980,7 +1981,7 @@ void safe_thread::thread_worker(std::function<void(void)> func, std::string name
{
try
{
utils::to_log(LOG_LEVEL_DEBUG, "+++ safe_thread of '%s(%p) - %p' is running ...\n", name.c_str(), addr, GetCurrentThreadId());
utils::to_log(LOG_LEVEL_DEBUG, "+++ safe_thread of '%s(addr: %p) - id: %p' is running ...\n", name.c_str(), addr, GetCurrentThreadId());
func();
utils::to_log(LOG_LEVEL_DEBUG, "--- safe_thread of '%s - %p' exited.\n", name.c_str(), GetCurrentThreadId());
return;