diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-14 01:45:54 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-14 01:45:54 +0100 |
commit | ca2c242e6fe37376394d0a0e2b574e94c40c4b57 (patch) | |
tree | bed7865e81da6355c52038ce1f37b5f8472c5a69 | |
parent | f18532698d11edec065f43f6da17d089545a27ff (diff) |
switch back to volatile bool for tracker flags
UI thread is the only writer for the flags. Makes no sense to use more
than volatile.
-rw-r--r-- | opentrack/tracker.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/opentrack/tracker.h b/opentrack/tracker.h index bf0047b4..f7f69a7b 100644 --- a/opentrack/tracker.h +++ b/opentrack/tracker.h @@ -1,6 +1,5 @@ #pragma once -#include <atomic> #include <vector> #include "timer.hpp" @@ -27,10 +26,10 @@ private: Pose output_pose, raw_6dof; double newpose[6]; - std::atomic<bool> centerp; - std::atomic<bool> enabledp; - std::atomic<bool> zero_; - std::atomic<bool> should_quit; + volatile bool centerp; + volatile bool enabledp; + volatile bool zero_; + volatile bool should_quit; SelectedLibraries const& libs; dmat<3, 3> r_b; @@ -47,7 +46,7 @@ public: void get_raw_and_mapped_poses(double* mapped, double* raw) const; void start() { QThread::start(); } - void toggle_enabled() { enabledp.store(!enabledp.load()); } - void center() { centerp.store(!centerp.load()); } - void zero() { zero_.store(!zero_.load()); } + void toggle_enabled() { enabledp = !enabledp; } + void center() { centerp = !centerp; } + void zero() { zero_ = !zero_; } }; |