Must join the previous thread before starting a new one or we crash
This commit is contained in:
parent
c479c6d68f
commit
1d034b16dd
|
@ -11,18 +11,17 @@ AnalysisThread::AnalysisThread(Monitor *monitor) :
|
|||
|
||||
AnalysisThread::~AnalysisThread() {
|
||||
Stop();
|
||||
if (thread_.joinable())
|
||||
thread_.join();
|
||||
if (thread_.joinable()) thread_.join();
|
||||
}
|
||||
|
||||
void AnalysisThread::Start() {
|
||||
if (thread_.joinable()) thread_.join();
|
||||
terminate_ = false;
|
||||
Debug(3, "Starting analysis thread");
|
||||
thread_ = std::thread(&AnalysisThread::Run, this);
|
||||
}
|
||||
|
||||
void AnalysisThread::Run() {
|
||||
Debug(2, "AnalysisThread::Run() for %d", monitor_->Id());
|
||||
|
||||
Microseconds analysis_rate = Microseconds(monitor_->GetAnalysisRate());
|
||||
Seconds analysis_update_delay = Seconds(monitor_->GetAnalysisUpdateDelay());
|
||||
Debug(2, "AnalysisThread::Run() have update delay %d", analysis_update_delay);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue