22#include <winpr/config.h>
24#include <winpr/synch.h>
25#include <winpr/interlocked.h>
28#define TAG WINPR_TAG("sync")
30#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
32BOOL winpr_InitOnceBeginInitialize(WINPR_ATTR_UNUSED
LPINIT_ONCE lpInitOnce,
33 WINPR_ATTR_UNUSED DWORD dwFlags,
34 WINPR_ATTR_UNUSED PBOOL fPending,
35 WINPR_ATTR_UNUSED LPVOID* lpContext)
37 WLog_ERR(TAG,
"not implemented");
41BOOL winpr_InitOnceComplete(WINPR_ATTR_UNUSED
LPINIT_ONCE lpInitOnce,
42 WINPR_ATTR_UNUSED DWORD dwFlags, WINPR_ATTR_UNUSED LPVOID lpContext)
44 WLog_ERR(TAG,
"not implemented");
48VOID winpr_InitOnceInitialize(WINPR_ATTR_UNUSED
PINIT_ONCE InitOnce)
50 WLog_ERR(TAG,
"not implemented");
53BOOL winpr_InitOnceExecuteOnce(
PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parameter,
58 switch ((ULONG_PTR)InitOnce->Ptr & 3)
67 if (InterlockedCompareExchangePointer(&InitOnce->Ptr, (PVOID)1, (PVOID)0) !=
75 if (InitFn(InitOnce, Parameter, Context))
78 InitOnce->Ptr = (PVOID)2;
83 InitOnce->Ptr = (PVOID)0;
91 WLog_ERR(TAG,
"internal error");