Export (0) Print
Expand All
Expand Minimize

CreateThreadpoolWork function

Creates a new work object.

Syntax


PTP_WORK WINAPI CreateThreadpoolWork(
  _In_         PTP_WORK_CALLBACK pfnwk,
  _Inout_opt_  PVOID pv,
  _In_opt_     PTP_CALLBACK_ENVIRON pcbe
);

Parameters

pfnwk [in]

The callback function. A worker thread calls this callback each time you call SubmitThreadpoolWork to post the work object. For details, see WorkCallback.

pv [in, out, optional]

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

pcbe [in, optional]

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 TP_WORK structure that defines the work 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 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 only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

CloseThreadpoolWork
SubmitThreadpoolWork
Thread Pools
WaitForThreadpoolWorkCallbacks

 

 

Community Additions

ADD
Show:
© 2014 Microsoft