VisionRunner: Add stop() function to stop a runForever() loop. (#826)

This was previously possible in Java with Thread.interrupt(), but provide
the same function in both C++ and Java.

Fixes #444.
This commit is contained in:
Peter Johnson
2017-12-10 20:58:14 -08:00
committed by GitHub
parent d2e7a90f41
commit 217b1a2259
3 changed files with 21 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#pragma once
#include <atomic>
#include <functional>
#include <memory>
@@ -31,12 +32,15 @@ class VisionRunnerBase : public ErrorBase {
void RunForever();
void Stop();
protected:
virtual void DoProcess(cv::Mat& image) = 0;
private:
std::unique_ptr<cv::Mat> m_image;
cs::CvSink m_cvSink;
std::atomic_bool m_enabled;
};
/**