From f805b1203b8dd98086decc7b05096f1521bd4883 Mon Sep 17 00:00:00 2001 From: Ivan Zhakov Date: Tue, 12 Mar 2024 14:22:35 +0000 Subject: [PATCH] On 1.7.x-r1871447 branch: Merge r1871925 from trunk. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x-r1871447@1916258 13f79535-47bb-0310-9956-ffa450edef68 --- include/arch/win32/apr_arch_misc.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/arch/win32/apr_arch_misc.h b/include/arch/win32/apr_arch_misc.h index 0305614c22..3cc91b0187 100644 --- a/include/arch/win32/apr_arch_misc.h +++ b/include/arch/win32/apr_arch_misc.h @@ -198,13 +198,14 @@ FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal); */ #define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ typedef rettype (calltype *apr_winapi_fpt_##fn) args; \ - static volatile apr_winapi_fpt_##fn apr_winapi_pfn_##fn = (PVOID) (ULONG_PTR) (-1); \ + static volatile apr_winapi_fpt_##fn apr_winapi_pfn_##fn = (apr_winapi_fpt_##fn) (ULONG_PTR) (-1); \ static APR_INLINE int apr_winapi_ld_##fn(void) \ { \ apr_winapi_fpt_##fn cached_func = apr_winapi_pfn_##fn; \ - if (cached_func == (PVOID) (ULONG_PTR) (-1)) { \ + if (cached_func == (apr_winapi_fpt_##fn) (ULONG_PTR) (-1)) { \ cached_func = (apr_winapi_fpt_##fn) apr_load_dll_func(lib, #fn, ord); \ - InterlockedExchangePointer(&((PVOID)apr_winapi_pfn_##fn), cached_func); \ + /* Pointer-sized writes are atomic on Windows. */ \ + apr_winapi_pfn_##fn = cached_func; \ } \ if (cached_func) return 1; else return 0; }; \ static APR_INLINE rettype apr_winapi_##fn args \