CreateThreadpoolWait function (threadpoolapiset.h)
Creates a new wait object.
PTP_WAIT CreateThreadpoolWait( [in] PTP_WAIT_CALLBACK pfnwa, [in, out, optional] PVOID pv, [in, optional] PTP_CALLBACK_ENVIRON pcbe );
The callback function to call when the wait completes or times out. For details, see WaitCallback.
[in, out, optional] pv
Optional application-defined data to pass to the callback function.
[in, optional] pcbe
A TP_CALLBACK_ENVIRON structure that defines the environment in which to execute the callback. The InitializeThreadpoolEnvironment function returns this structure.
If this parameter is NULL, the callback executes in the default callback environment. For more information, see InitializeThreadpoolEnvironment.
If the function succeeds, it returns a pointer to a TP_WAIT structure that defines the wait object. Applications do not modify the members of this structure.
If the function fails, it returns NULL. To retrieve extended error information, call GetLastError.
The work item and all functions it calls must not rely on the thread after they have returned. Therefore, you cannot call an asynchronous call that requires a persistent thread, such as the RegNotifyChangeKeyValue function without the REG_NOTIFY_THREAD_AGNOSTIC flag, from the default callback environment. Instead, use a thread whose lifetime you control.
To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or higher.
For an example, see Using the Thread Pool Functions.
|Minimum supported client||Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2008 [desktop apps | UWP apps]|
|Header||threadpoolapiset.h (include Windows 7, Windows Server 2008 Windows Server 2008 R2, Windows.h)|