mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-16 21:08:01 -04:00
Monitor: Make analysis_thread a unique_ptr
The AnalysisThread object is owned by the Monitor. Signal this by using unique_ptr.
This commit is contained in:
@@ -4,10 +4,8 @@
|
||||
#include "zm_signal.h"
|
||||
#include "zm_utils.h"
|
||||
|
||||
//AnalysisThread::AnalysisThread(std::shared_ptr<Monitor> monitor) :
|
||||
AnalysisThread::AnalysisThread(Monitor* monitor) :
|
||||
AnalysisThread::AnalysisThread(Monitor *monitor) :
|
||||
monitor_(monitor), terminate_(false) {
|
||||
//monitor_(std::move(monitor)), terminate_(false) {
|
||||
thread_ = std::thread(&AnalysisThread::Run, this);
|
||||
}
|
||||
|
||||
@@ -43,7 +41,7 @@ void AnalysisThread::Run() {
|
||||
|
||||
Debug(2, "Analyzing");
|
||||
if (!monitor_->Analyse()) {
|
||||
if ( !(terminate_ or zm_terminate) ) {
|
||||
if (!(terminate_ or zm_terminate)) {
|
||||
Microseconds sleep_for = monitor_->Active() ? Microseconds(ZM_SAMPLE_RATE) : Microseconds(ZM_SUSPENDED_RATE);
|
||||
Debug(2, "Sleeping for %" PRId64 "us", int64(sleep_for.count()));
|
||||
std::this_thread::sleep_for(sleep_for);
|
||||
|
||||
Reference in New Issue
Block a user