Must join the previous thread before starting a new one or we crash

This commit is contained in:
Isaac Connor
2021-04-17 11:31:36 -04:00
parent c479c6d68f
commit 1d034b16dd
2 changed files with 5 additions and 6 deletions

View File

@@ -10,11 +10,11 @@ DecoderThread::DecoderThread(Monitor *monitor) :
DecoderThread::~DecoderThread() {
Stop();
if (thread_.joinable())
thread_.join();
if (thread_.joinable()) thread_.join();
}
void DecoderThread::Start() {
if (thread_.joinable()) thread_.join();
terminate_ = false;
thread_ = std::thread(&DecoderThread::Run, this);
}