PINIT_ONCE_FN 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

PINIT_ONCE_FN PinitOnceFn;

BOOL PinitOnceFn(
  PINIT_ONCE InitOnce,
  PVOID Parameter,
  PVOID *Context
)
{...}

Parameters

InitOnce

A pointer to the one-time initialization structure.

Parameter

An optional parameter that was passed to the callback function.

Context

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 | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header synchapi.h (include Windows.h)

See Also

InitOnceExecuteOnce

InitOnceInitialize

Synchronization Functions