Skip to content

Commit

Permalink
On 1.7.x-r1871447 branch:
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
Ivan Zhakov committed Mar 12, 2024
1 parent ed1e87e commit f805b12
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/arch/win32/apr_arch_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit f805b12

Please sign in to comment.