ZMQReader: make sure monitor always shuts down

This commit is contained in:
SChernykh 2023-06-20 16:53:03 +02:00
parent 1b9d14e89d
commit 1c7646f98f

View file

@ -155,7 +155,11 @@ void ZMQReader::run()
LOGERR(1, "failed to start ZMQ monitor thread, error " << uv_err_name(err)); LOGERR(1, "failed to start ZMQ monitor thread, error " << uv_err_name(err));
throw zmq::error_t(EMTHREAD); throw zmq::error_t(EMTHREAD);
} }
ON_SCOPE_LEAVE([this]() { uv_thread_join(&m_monitorThread); });
ON_SCOPE_LEAVE([this]() {
m_monitor->abort();
uv_thread_join(&m_monitorThread);
});
LOGINFO(1, "worker thread ready"); LOGINFO(1, "worker thread ready");
@ -166,7 +170,6 @@ void ZMQReader::run()
} }
if (m_stopped) { if (m_stopped) {
m_monitor->abort();
break; break;
} }