diff options
author | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-12 12:51:04 +0000 |
---|---|---|
committer | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-12 12:51:04 +0000 |
commit | 414fbab8b87af50117530bd3150a17bf2a569364 (patch) | |
tree | a838b8d8b028f6a298480acfe488676bcb52b96d | |
parent | 67043ea8687ed689183af9c98f0c347e459fb805 (diff) | |
download | libapr-414fbab8b87af50117530bd3150a17bf2a569364.tar.gz |
Merge r1896811 from trunk:
apr_atomic_set64: Follow up to r1868129.
Like for apr_atomic_read64() in r1868502, use direct memory write on x86_x64.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896960 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | atomic/win32/apr_atomic64.c | 7 |
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) |