summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-04-20 12:29:44 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-04-20 12:29:44 +0200
commit1f2409090a7e60ff4ec3b70a3161f2799d16cad5 (patch)
treeea4e59ae25e0237628fd03a58096e5f1cb8bb5a4
parent411d03ac6b8ee1a8c06f952b9378c90516a715b7 (diff)
downloaddabmod-1f2409090a7e60ff4ec3b70a3161f2799d16cad5.tar.gz
dabmod-1f2409090a7e60ff4ec3b70a3161f2799d16cad5.tar.bz2
dabmod-1f2409090a7e60ff4ec3b70a3161f2799d16cad5.zip
Fix thread teardown in RC
-rw-r--r--src/RemoteControl.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp
index a3d9ec3..f7fff50 100644
--- a/src/RemoteControl.cpp
+++ b/src/RemoteControl.cpp
@@ -48,7 +48,14 @@ RemoteControllerTelnet::~RemoteControllerTelnet()
{
m_active = false;
m_io_service.stop();
- m_child_thread.join();
+
+ if (m_restarter_thread.joinable()) {
+ m_restarter_thread.join();
+ }
+
+ if (m_child_thread.joinable()) {
+ m_child_thread.join();
+ }
}
void RemoteControllerTelnet::restart()
@@ -341,6 +348,10 @@ RemoteControllerZmq::~RemoteControllerZmq() {
m_active = false;
m_fault = false;
+ if (m_restarter_thread.joinable()) {
+ m_restarter_thread.join();
+ }
+
if (m_child_thread.joinable()) {
m_child_thread.join();
}