summaryrefslogtreecommitdiff
path: root/atomic
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2022-01-07 15:26:21 +0000
committerYann Ylavic <ylavic@apache.org>2022-01-07 15:26:21 +0000
commit61a479e4f3352f86e7abb9f452ef6c553ed351cb (patch)
tree5e64d05b21a7e859e99508f4e15b9754e0ab1c72 /atomic
parent6a19b3060e7984f4977facbd58d11fb1ad64e50a (diff)
downloadapr-61a479e4f3352f86e7abb9f452ef6c553ed351cb.tar.gz
apr_atomic_set64: Follow up to r1868129.
Like for apr_atomic_read64() in r1868502, use direct memory write on x86_x64. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896811 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r--atomic/win32/apr_atomic64.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/atomic/win32/apr_atomic64.c b/atomic/win32/apr_atomic64.c
index 372003aaa..a9139d96a 100644
--- a/atomic/win32/apr_atomic64.c
+++ b/atomic/win32/apr_atomic64.c
@@ -46,7 +46,14 @@ APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem)
APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)
{
+#if defined(_M_X64)
+ /* https://docs.microsoft.com/en-us/windows/win32/sync/interlocked-variable-access
+ * "Simple reads and writes to properly aligned 64-bit variables are atomic
+ * on 64-bit Windows."*/
+ *mem = val;
+#else
InterlockedExchange64((volatile LONG64 *)mem, val);
+#endif
}
APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)