Export (0) Print
Expand All
Expand Minimize

InitOnceCallback callback function

An application-defined callback function. Specify a pointer to this function when calling the InitOnceExecuteOnce function. The PINIT_ONCE_FN type defines a pointer to this callback function. InitOnceCallback is a placeholder for the application-defined function name.

Syntax


BOOL CALLBACK InitOnceCallback(
  _Inout_      PINIT_ONCE InitOnce,
  _Inout_opt_  PVOID Parameter,
  _Out_opt_    PVOID *Context
);

Parameters

InitOnce [in, out]

A pointer to the one-time initialization structure.

Parameter [in, out, optional]

An optional parameter that was passed to the callback function.

Context [out, optional]

The data to be stored with the one-time initialization structure. If Context references a value, the low-order INIT_ONCE_CTX_RESERVED_BITS of the value must be zero. If Context points to a data structure, the data structure must be DWORD-aligned.

Return value

If the function returns TRUE, the block is marked as initialized.

If the function returns FALSE, the block is not marked as initialized and the call to InitOnceExecuteOnce fails. To communicate additional error information, call SetLastError before returning FALSE.

Remarks

This function can create a synchronization object and return it in the lpContext parameter.

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 | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]

Header

WinBase.h (include Windows.h)

See also

InitOnceExecuteOnce
InitOnceInitialize
Synchronization Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft