summaryrefslogtreecommitdiffhomepage
path: root/pose-widget/pose-widget.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-02-21 19:29:28 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-02-21 19:29:28 +0100
commitc06048a7af347bf843bf25bd305cbbf4d6cec266 (patch)
tree15b3ae75465198d1ec2bdd21d6879305c74680ca /pose-widget/pose-widget.cpp
parentff38e35d832b7c7a3e189bee4a80271fd3a3c978 (diff)
do less global memory fences in atomics
Diffstat (limited to 'pose-widget/pose-widget.cpp')
-rw-r--r--pose-widget/pose-widget.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp
index 943fc0ad..e9bf1d01 100644
--- a/pose-widget/pose-widget.cpp
+++ b/pose-widget/pose-widget.cpp
@@ -62,7 +62,7 @@ void pose_transform::run()
{
lock_guard l(mtx);
- if (fresh)
+ if (fresh.load(std::memory_order_relaxed))
goto end;
rotation = rotation_;
@@ -88,8 +88,7 @@ void pose_widget::rotate_async(double xAngle, double yAngle, double zAngle, doub
if (!check_is_visible())
return;
- bool expected = true;
- if (xform.fresh.compare_exchange_weak(expected, false))
+ if (bool X = true; xform.fresh.compare_exchange_weak(X, false, std::memory_order_relaxed))
{
repaint();
xform.rotate_async(xAngle, yAngle, zAngle, x, y, z);
@@ -266,7 +265,7 @@ void pose_transform::project_quad_texture()
{
lock_guard l(mtx2);
image.swap(image2);
- fresh = true;
+ fresh.store(true, std::memory_order_relaxed);
return;
}
@@ -358,7 +357,7 @@ void pose_transform::project_quad_texture()
{
lock_guard l2(mtx2);
image.swap(image2);
- fresh = true;
+ fresh.store(true, std::memory_order_relaxed);
}
}