CreateThreadpoolCleanupGroup function (threadpoolapiset.h)

Creates a cleanup group that applications can use to track one or more thread pool callbacks.


PTP_CLEANUP_GROUP CreateThreadpoolCleanupGroup();

Return value

If the function succeeds, it returns a pointer to a TP_CLEANUP_GROUP structure of the newly allocated cleanup group. Applications do not modify the members of this structure.

If function fails, it returns NULL. To retrieve extended error information, call GetLastError.


After creating the cleanup group, call SetThreadpoolCallbackCleanupGroup to associate the cleanup group with a callback environment.

A member is added to the group each time you call one of the following functions:

You use one of the following corresponding close functions to remove a member from the group.

To close all the callbacks, call CloseThreadpoolCleanupGroupMembers.

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


For an example, see Using the Thread Pool Functions.


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

See also




Thread Pools