Make DecoderThread::Stop wait for the thread to stop

This commit is contained in:
Isaac Connor
2022-06-17 17:23:33 -04:00
parent ed66f1b1a8
commit 3c8b590925
2 changed files with 7 additions and 2 deletions

View File

@@ -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());