CreateThreadpoolTimer function (threadpoolapiset.h)
Creates a new timer object.
Syntax
PTP_TIMER CreateThreadpoolTimer(
[in] PTP_TIMER_CALLBACK pfnti,
[in, out, optional] PVOID pv,
[in, optional] PTP_CALLBACK_ENVIRON pcbe
);
Parameters
[in] pfnti
The callback function to call each time the timer object expires. For details, see TimerCallback.
[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.
Return value
If the function succeeds, it returns a pointer to a TP_TIMER structure that defines the timer object. Applications do not modify the members of this structure.
If the function fails, it returns NULL. To retrieve extended error information, call GetLastError.
Remarks
To set the timer object, call the SetThreadpoolTimer 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 | threadpoolapiset.h (include Windows.h on Windows 7, Windows Server 2008 Windows Server 2008 R2) |
Library | Kernel32.lib |
DLL | Kernel32.dll |