Export (0) Print
Expand All
Expand Minimize

InitOnceComplete function

Completes one-time initialization started with the InitOnceBeginInitialize function.

Syntax


BOOL WINAPI InitOnceComplete(
  _Inout_   LPINIT_ONCE lpInitOnce,
  _In_      DWORD dwFlags,
  _In_opt_  LPVOID lpContext
);

Parameters

lpInitOnce [in, out]

A pointer to the one-time initialization structure.

dwFlags [in]

This parameter can be one of the following flags.

ValueMeaning
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 [in, optional]

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.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Examples

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

Requirements

Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]

Header

WinBase.h on Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2 (include Windows.h);
Synchapi.h on Windows 8 and Windows Server 2012

Library

Kernel32.lib

DLL

Kernel32.dll

See also

InitOnceBeginInitialize
One-Time Initialization
Synchronization Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft