diff --git a/src/zm_analysis_thread.cpp b/src/zm_analysis_thread.cpp index 517fb02a8..a646f4952 100644 --- a/src/zm_analysis_thread.cpp +++ b/src/zm_analysis_thread.cpp @@ -24,6 +24,9 @@ void AnalysisThread::Start() { void AnalysisThread::Stop() { terminate_ = true; } +void AnalysisThread::Join() { + if (thread_.joinable()) thread_.join(); +} void AnalysisThread::Run() { while (!(terminate_ or zm_terminate)) { diff --git a/src/zm_analysis_thread.h b/src/zm_analysis_thread.h index c90bb2acb..64ddf895c 100644 --- a/src/zm_analysis_thread.h +++ b/src/zm_analysis_thread.h @@ -16,6 +16,7 @@ class AnalysisThread { void Start(); void Stop(); + void Join(); bool Stopped() const { return terminate_; } private: diff --git a/src/zm_decoder_thread.cpp b/src/zm_decoder_thread.cpp index 1f7946f95..fa36f06b9 100644 --- a/src/zm_decoder_thread.cpp +++ b/src/zm_decoder_thread.cpp @@ -23,6 +23,10 @@ void DecoderThread::Stop() { terminate_ = true; } +void DecoderThread::Join() { + if (thread_.joinable()) thread_.join(); +} + void DecoderThread::Run() { Debug(2, "DecoderThread::Run() for %d", monitor_->Id()); diff --git a/src/zm_decoder_thread.h b/src/zm_decoder_thread.h index 4fb8ea453..e40b0e7ce 100644 --- a/src/zm_decoder_thread.h +++ b/src/zm_decoder_thread.h @@ -16,6 +16,7 @@ class DecoderThread { void Start(); void Stop(); + void Join(); private: void Run();