mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Communication: Fix issue where driver failing to open leaves dangling thread
This commit is contained in:
@@ -23,8 +23,10 @@ bool Communication::open() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!driver->open())
|
||||
return false;
|
||||
spawnThreads();
|
||||
return driver->open();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Communication::spawnThreads() {
|
||||
@@ -39,13 +41,13 @@ void Communication::joinThreads() {
|
||||
}
|
||||
|
||||
bool Communication::close() {
|
||||
joinThreads();
|
||||
|
||||
if(!isOpen()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
joinThreads();
|
||||
|
||||
return driver->close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user