J2534_WIN: Fix application hang on unexpected USB removal.
parent
3944a81c84
commit
de294ccbf7
|
@ -420,6 +420,8 @@ bool Panda::can_recv_async(HANDLE kill_event, std::vector<PANDA_CAN_MSG>& msg_bu
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
} else { // ERROR_BAD_COMMAND happens when device is unplugged.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ PandaJ2534Device::~PandaJ2534Device() {
|
|||
SetEvent(this->can_kill_event);
|
||||
DWORD res = WaitForSingleObject(this->can_thread_handle, INFINITE);
|
||||
CloseHandle(this->can_thread_handle);
|
||||
CloseHandle(this->can_kill_event);
|
||||
}
|
||||
|
||||
std::unique_ptr<PandaJ2534Device> PandaJ2534Device::openByName(std::string sn) {
|
||||
|
|
Loading…
Reference in New Issue