From e88c7b29ea9ec9fcd6ac6b15c965085152100d2e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Jun 2017 18:19:17 +0200 Subject: get rid of "volatile" abuse We heavily used "volatile bool" to check if the thread loop should stop. But this functionality is already provided by Qt5's QThread::requestInterruption. In other cases, "volatile" is wonderfully underspecified so it's better to ditch its usage in favor of std::atomic. At the time we don't appear to be using the "volatile" keyword except when calling win32's Interlocked*() family of functions as necessary. In freetrackclient's header the "volatile" qualifier was used as part of a typedef. This doesn't work. Use it as part of data declaration. --- tracker-aruco/ftnoir_tracker_aruco.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tracker-aruco/ftnoir_tracker_aruco.cpp') diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index 7a19b0d3..745ce50d 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -52,7 +52,6 @@ aruco_tracker::aruco_tracker() : roi_points(4), last_roi(65535, 65535, 0, 0), adaptive_size_pos(0), - stop(false), use_otsu(false) { // param 2 ignored for Otsu thresholding. it's required to use our fork of Aruco. @@ -61,7 +60,7 @@ aruco_tracker::aruco_tracker() : aruco_tracker::~aruco_tracker() { - stop = true; + requestInterruption(); wait(); // fast start/stop causes breakage portable::sleep(1000); @@ -368,7 +367,7 @@ void aruco_tracker::run() fps_timer.start(); last_detection_timer.start(); - while (!stop) + while (!isInterruptionRequested()) { { QMutexLocker l(&camera_mtx); -- cgit v1.2.3