aboutsummaryrefslogtreecommitdiffstats
path: root/src/RemoteControl.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-04-11 15:29:49 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-04-11 15:29:49 +0200
commit7514a3951bdee4fe71f877e83fc6acf18bc847e5 (patch)
tree5c20634f5295c72242d9e4abe392c96818ad519b /src/RemoteControl.cpp
parent766f9f420aae19ecf282a32e7f9e2add275d9b14 (diff)
downloaddabmod-7514a3951bdee4fe71f877e83fc6acf18bc847e5.tar.gz
dabmod-7514a3951bdee4fe71f877e83fc6acf18bc847e5.tar.bz2
dabmod-7514a3951bdee4fe71f877e83fc6acf18bc847e5.zip
Fix thread handling in remotecontrol
Diffstat (limited to 'src/RemoteControl.cpp')
-rw-r--r--src/RemoteControl.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp
index 6e6a7e9..a3d9ec3 100644
--- a/src/RemoteControl.cpp
+++ b/src/RemoteControl.cpp
@@ -53,6 +53,10 @@ RemoteControllerTelnet::~RemoteControllerTelnet()
void RemoteControllerTelnet::restart()
{
+ if (m_restarter_thread.joinable()) {
+ m_restarter_thread.join();
+ }
+
m_restarter_thread = std::thread(
&RemoteControllerTelnet::restart_thread,
this, 0);
@@ -105,7 +109,9 @@ void RemoteControllerTelnet::restart_thread(long)
m_active = false;
m_io_service.stop();
- m_child_thread.join();
+ if (m_child_thread.joinable()) {
+ m_child_thread.join();
+ }
m_child_thread = std::thread(&RemoteControllerTelnet::process, this, 0);
}
@@ -342,6 +348,10 @@ RemoteControllerZmq::~RemoteControllerZmq() {
void RemoteControllerZmq::restart()
{
+ if (m_restarter_thread.joinable()) {
+ m_restarter_thread.join();
+ }
+
m_restarter_thread = std::thread(&RemoteControllerZmq::restart_thread, this);
}