InitializeThreadpoolEnvironment function
Initializes a callback environment.
Syntax
VOID InitializeThreadpoolEnvironment( _Out_ PTP_CALLBACK_ENVIRON pcbe );
Parameters
- pcbe [out]
-
A TP_CALLBACK_ENVIRON structure that defines a callback environment.
Return value
This function does not return a value.
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:
- SetThreadpoolCallbackCleanupGroup
- SetThreadpoolCallbackLibrary
- SetThreadpoolCallbackPool
- SetThreadpoolCallbackPriority
- SetThreadpoolCallbackRunsLong
To use the default callback environment, set the optional callback environment parameter to NULL when calling one of the following functions:
- CreateThreadpoolIo
- CreateThreadpoolTimer
- CreateThreadpoolWait
- CreateThreadpoolWork
- TrySubmitThreadpoolCallback
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
|
Minimum supported client |
Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2008 [desktop apps | Windows Store apps] |
|
Header |
|
See also
- DestroyThreadpoolEnvironment
- SetThreadpoolCallbackCleanupGroup
- SetThreadpoolCallbackLibrary
- SetThreadpoolCallbackPool
- SetThreadpoolCallbackRunsLong
- Thread Pools