InitializeThreadpoolEnvironment function (winbase.h)

Initializes a callback environment.

Syntax

void InitializeThreadpoolEnvironment(
  [out] PTP_CALLBACK_ENVIRON pcbe
);

Parameters

[out] pcbe

A TP_CALLBACK_ENVIRON structure that defines a callback environment.

Return value

None

Remarks

By default, a callback executes in the default thread pool for the process. No cleanup group is associated with the callback environment, the caller is responsible for keeping the callback's DLL loaded while there are outstanding callbacks, and the callback is expected to run in a reasonable amount of time for the application.

Create a callback environment if you plan to call one of the following functions to modify the environment:

To use the default callback environment, set the optional callback environment parameter to NULL when calling one of the following functions: The InitializeThreadpoolEnvironment function is implemented as an inline function.

To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or higher.

Examples

For an example, see Using the Thread Pool Functions.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header winbase.h (include Windows.h)

See also

DestroyThreadpoolEnvironment

SetThreadpoolCallbackCleanupGroup

SetThreadpoolCallbackLibrary

SetThreadpoolCallbackPool

SetThreadpoolCallbackRunsLong

Thread Pools