From 0d0326645510d821901cec9595e7ef1b7ca07bfa Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 26 Oct 2024 13:33:26 -0400 Subject: [PATCH] Don't join in Stop methods. THe decode and analysis thread may never get woken up from packetqueue. Leave it for the destructor. --- src/zm_analysis_thread.cpp | 2 +- src/zm_decoder_thread.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zm_analysis_thread.cpp b/src/zm_analysis_thread.cpp index 9533dae0f..517fb02a8 100644 --- a/src/zm_analysis_thread.cpp +++ b/src/zm_analysis_thread.cpp @@ -11,6 +11,7 @@ AnalysisThread::AnalysisThread(Monitor *monitor) : AnalysisThread::~AnalysisThread() { Stop(); + if (thread_.joinable()) thread_.join(); } void AnalysisThread::Start() { @@ -22,7 +23,6 @@ void AnalysisThread::Start() { void AnalysisThread::Stop() { terminate_ = true; - if (thread_.joinable()) thread_.join(); } void AnalysisThread::Run() { diff --git a/src/zm_decoder_thread.cpp b/src/zm_decoder_thread.cpp index 256d82107..1f7946f95 100644 --- a/src/zm_decoder_thread.cpp +++ b/src/zm_decoder_thread.cpp @@ -10,6 +10,7 @@ DecoderThread::DecoderThread(Monitor *monitor) : DecoderThread::~DecoderThread() { Stop(); + if (thread_.joinable()) thread_.join(); } void DecoderThread::Start() { @@ -20,7 +21,6 @@ void DecoderThread::Start() { void DecoderThread::Stop() { terminate_ = true; - if (thread_.joinable()) thread_.join(); } void DecoderThread::Run() {