TrySubmitThreadpoolCallback function (threadpoolapiset.h)

Requests that a thread pool worker thread call the specified callback function.

Syntax

BOOL TrySubmitThreadpoolCallback(
  [in]                PTP_SIMPLE_CALLBACK  pfns,
  [in, out, optional] PVOID                pv,
  [in, optional]      PTP_CALLBACK_ENVIRON pcbe
);

Parameters

[in] pfns

The callback function. For details, see SimpleCallback.

[in, out, optional] pv

Optional application-defined data to pass to the callback function.

[in, optional] pcbe

A pointer to a TP_CALLBACK_ENVIRON structure that defines the environment in which to execute the callback function. Use the InitializeThreadpoolEnvironment function to initialize the structure before calling this function.

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 TRUE.

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

Remarks

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

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

See also

CallbackMayRunLong

DisassociateCurrentThreadFromCallback

FreeLibraryWhenCallbackReturns

InitializeThreadpoolEnvironment

LeaveCriticalSectionWhenCallbackReturns

ReleaseMutexWhenCallbackReturns

ReleaseSemaphoreWhenCallbackReturns

SetEventWhenCallbackReturns

Thread Pools