From 1f2409090a7e60ff4ec3b70a3161f2799d16cad5 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 20 Apr 2018 12:29:44 +0200 Subject: Fix thread teardown in RC --- src/RemoteControl.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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(); } -- cgit v1.2.3