ConnectionThread destructor calls EventFd::notify() which may throw. In
such case the thread will be destroyed before joining, which will
result in program termination. Make sure that the std::thread::join()
is called even if EventFd::notify throws.
Change-Id: Ieb5cbcf4440b2c9d22c2d30410fd2b9263070b2f
m_join = true;
try {
m_eventFd.notify();
- m_thread.join();
- } catch (CKM::Exception &e) {
+ } catch (const CKM::Exception &e) {
LogError("CKM::Exception::Exception " << e.DumpToString());
- } catch (std::exception &e) {
+ } catch (const std::exception &e) {
LogError("STD exception " << e.what());
} catch (...) {
LogError("Unknown exception occured");
}
+
+ try {
+ m_thread.join();
+ } catch (const std::system_error &e) {
+ LogError("STD exception " << e.what());
+ }
}
void ConnectionThread::run()