Make AnalysisThread::Stop wait for the thread to stop
parent
bd711c5230
commit
ed66f1b1a8
|
@ -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
|
||||
|
|
|
@ -15,7 +15,7 @@ class AnalysisThread {
|
|||
AnalysisThread(AnalysisThread &&rhs) = delete;
|
||||
|
||||
void Start();
|
||||
void Stop() { terminate_ = true; }
|
||||
void Stop();
|
||||
bool Stopped() const { return terminate_; }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue