Make AnalysisThread::Stop wait for the thread to stop

pull/3509/head
Isaac Connor 2022-06-17 17:23:25 -04:00
parent bd711c5230
commit ed66f1b1a8
2 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,6 @@ AnalysisThread::AnalysisThread(Monitor *monitor) :
AnalysisThread::~AnalysisThread() {
Stop();
if (thread_.joinable()) thread_.join();
}
void AnalysisThread::Start() {
@ -21,6 +20,11 @@ void AnalysisThread::Start() {
thread_ = std::thread(&AnalysisThread::Run, this);
}
void AnalysisThread::Stop() {
terminate_ = true;
if (thread_.joinable()) thread_.join();
}
void AnalysisThread::Run() {
while (!(terminate_ or zm_terminate)) {
// Some periodic updates are required for variable capturing framerate

View File

@ -15,7 +15,7 @@ class AnalysisThread {
AnalysisThread(AnalysisThread &&rhs) = delete;
void Start();
void Stop() { terminate_ = true; }
void Stop();
bool Stopped() const { return terminate_; }
private: