diff --git a/src/zm_decoder_thread.cpp b/src/zm_decoder_thread.cpp index 0ffeadfc5..5c1033985 100644 --- a/src/zm_decoder_thread.cpp +++ b/src/zm_decoder_thread.cpp @@ -10,7 +10,6 @@ DecoderThread::DecoderThread(Monitor *monitor) : DecoderThread::~DecoderThread() { Stop(); - if (thread_.joinable()) thread_.join(); } void DecoderThread::Start() { @@ -18,6 +17,12 @@ void DecoderThread::Start() { terminate_ = false; thread_ = std::thread(&DecoderThread::Run, this); } + +void DecoderThread::Stop() { + terminate_ = true; + 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 62b2f0d23..4fb8ea453 100644 --- a/src/zm_decoder_thread.h +++ b/src/zm_decoder_thread.h @@ -15,7 +15,7 @@ class DecoderThread { DecoderThread(DecoderThread &&rhs) = delete; void Start(); - void Stop() { terminate_ = true; } + void Stop(); private: void Run();