Make DecoderThread::Stop wait for the thread to stop

This commit is contained in:
Isaac Connor committed 2022-06-17 17:23:33 -04:00
1 parent ed66f1b1a8
commit 3c8b590925
2 files changed
+7 -2

No files matched your search

+6 -1
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());