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-hatire/ftnoir_tracker_hat.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tracker-hatire') diff --git a/tracker-hatire/ftnoir_tracker_hat.h b/tracker-hatire/ftnoir_tracker_hat.h index 01b2afff..47f66812 100644 --- a/tracker-hatire/ftnoir_tracker_hat.h +++ b/tracker-hatire/ftnoir_tracker_hat.h @@ -5,6 +5,8 @@ #include "ftnoir_tracker_hat_settings.h" #include "ftnoir_arduino_type.h" +#include + #include #include #include @@ -41,7 +43,7 @@ private: int frame_cnt; - volatile int CptError; + std::atomic CptError; static inline QByteArray to_latin1(const QString& str) { return str.toLatin1(); } }; -- cgit v1.2.3