Files
zoneminder/src/zm_analysis_thread.h
Peter Keresztes Schmidt 42484e6434 zmc: Fix a deadlock on shutdown/reconnection
First stop the analysis threads, then close the monitors and thus drain the packet queues before trying to join the analysis threads since they might hang while waiting for the next packet to arrive.
2021-02-11 15:48:22 +01:00

27 lines
516 B
C++

#ifndef ZM_ANALYSIS_THREAD_H
#define ZM_ANALYSIS_THREAD_H
#include "zm_monitor.h"
#include <atomic>
#include <memory>
#include <thread>
class AnalysisThread {
public:
explicit AnalysisThread(std::shared_ptr<Monitor> monitor);
~AnalysisThread();
AnalysisThread(AnalysisThread &rhs) = delete;
AnalysisThread(AnalysisThread &&rhs) = delete;
void Stop() { terminate_ = true; }
private:
void Run();
std::shared_ptr<Monitor> monitor_;
std::atomic<bool> terminate_;
std::thread thread_;
};
#endif