summaryrefslogtreecommitdiff
path: root/core/templates
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2022-07-19 10:04:59 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-07-19 10:04:59 +0200
commit02a584d8e68fad988fbbe43e05f8437284c00733 (patch)
tree71bab20fcb4c1474ca945282e7c6cb4a9f09f7ca /core/templates
parent3ae61590e1ca3d4df078f4aa728856586e828bc2 (diff)
Use the right memory ordering in SafeNumeric operations
Diffstat (limited to 'core/templates')
-rw-r--r--core/templates/safe_refcount.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/templates/safe_refcount.h b/core/templates/safe_refcount.h
index 76f76be96a..3148283dca 100644
--- a/core/templates/safe_refcount.h
+++ b/core/templates/safe_refcount.h
@@ -111,7 +111,7 @@ public:
if (tmp >= p_value) {
return tmp; // already greater, or equal
}
- if (value.compare_exchange_weak(tmp, p_value, std::memory_order_release)) {
+ if (value.compare_exchange_weak(tmp, p_value, std::memory_order_acq_rel)) {
return p_value;
}
}
@@ -123,7 +123,7 @@ public:
if (c == 0) {
return 0;
}
- if (value.compare_exchange_weak(c, c + 1, std::memory_order_release)) {
+ if (value.compare_exchange_weak(c, c + 1, std::memory_order_acq_rel)) {
return c + 1;
}
}