Export (0) Print
Expand All
Expand Minimize

CreateThreadpoolIo function

Creates a new I/O completion object.

Syntax


PTP_IO WINAPI CreateThreadpoolIo(
  _In_         HANDLE fl,
  _In_         PTP_WIN32_IO_CALLBACK pfnio,
  _Inout_opt_  PVOID pv,
  _In_opt_     PTP_CALLBACK_ENVIRON pcbe
);

Parameters

fl [in]

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

pfnio [in]

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

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

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

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinBase.h on Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2 (include Windows.h);
Threadpoolapiset.h on Windows 8 and Windows Server 2012

Library

Kernel32.lib

DLL

Kernel32.dll

See also

CancelThreadpoolIo
CloseThreadpoolIo
StartThreadpoolIo
Thread Pools
WaitForThreadpoolIoCallbacks

 

 

Community Additions

ADD
Show:
© 2014 Microsoft