InitOnceComplete function

Completes one-time initialization started with the InitOnceBeginInitialize function.

Syntax

BOOL InitOnceComplete(
  LPINIT_ONCE lpInitOnce,
  DWORD       dwFlags,
  LPVOID      lpContext
);

Parameters

lpInitOnce

A pointer to the one-time initialization structure.

dwFlags

This parameter can be one of the following flags.

Value Meaning
INIT_ONCE_ASYNC
0x00000002UL
Operate in asynchronous mode. This enables multiple completion attempts to execute in parallel. This flag must match the flag passed in the corresponding call to the InitOnceBeginInitialize function. This flag may not be combined with INIT_ONCE_INIT_FAILED.
INIT_ONCE_INIT_FAILED
0x00000004UL
The initialization attempt failed. This flag may not be combined with INIT_ONCE_ASYNC. To fail an asynchronous initialization, merely abandon it (that is, do not call the InitOnceComplete function).

lpContext

A pointer to the data to be stored with the one-time initialization structure. This data is returned in the lpContext parameter passed to subsequent calls to the InitOnceBeginInitialize function. If lpContext points to a value, the low-order INIT_ONCE_CTX_RESERVED_BITS of the value must be zero. If lpContext points to a data structure, the data structure must be DWORD-aligned.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.

Examples

For an example that uses this function, see Using One-Time Initialization.

Requirements

   
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header synchapi.h (include Windows 7, Windows Server 2008 Windows Server 2008 R2, Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

InitOnceBeginInitialize

One-Time Initialization

Synchronization Functions