CreateThreadpoolIo

Creates a new I/O completion object.

Syntax

PTP_IO CreateThreadpoolIo(
         HANDLE fl,
         PTP_WIN32_IO_CALLBACK pfnio,
         PVOID pv,
         PTP_CALLBACK_ENVIRON pcbe
)  

Parameters

fl
Type: HANDLE 

[in] The file handle to bind to this I/O completion object.

pfnio
Type: PTP_WIN32_IO_CALLBACK 

[in] The callback function to be called each time an overlapped I/O operation completes on the file. For details, see IoCompletionCallback.

pv
Type: PVOID 

[in, out, optional] Optional application-defined data to pass to the callback function.

pcbe
Type: PTP_CALLBACK_ENVIRON 

[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

Type: PTP_IO 

If the function succeeds, it returns a TP_IO structure that defines the I/O 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 begin receiving overlapped I/O completion callbacks, call the StartThreadpoolIo function.

If the file handle bound to the I/O completion object has the notification mode FILE_SKIP_COMPLETION_PORT_ON_SUCCESS and an asychronous I/O operation returns immediately with success, the I/O completion callback function is not called and threadpool I/O notifications must be canceled. For more information, see CancelThreadpoolIo.

Requirements

Header: Declared in threadpoolapiset.h.

Library: Use kernelx.lib.