WaitForThreadpoolIoCallbacks function (threadpoolapiset.h)

Waits for outstanding I/O completion callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.

Syntax

void WaitForThreadpoolIoCallbacks(
  [in, out] PTP_IO pio,
  [in]      BOOL   fCancelPendingCallbacks
);

Parameters

[in, out] pio

A pointer to a TP_IO structure that defines the I/O completion object. The CreateThreadpoolIo function returns this pointer.

[in] fCancelPendingCallbacks

Indicates whether to cancel queued callbacks that have not yet started to execute.

Return value

None

Remarks

When fCancelPendingCallbacks is set to TRUE, only queued callbacks are canceled. Pending I/O requests are not canceled. Therefore, the caller should call GetOverlappedResult for the OVERLAPPED structure to check whether the I/O operation has completed before freeing the structure. As an alternative, set fCancelPendingCallbacks to FALSE and have the associated I/O completion callback free the OVERLAPPED structure. Be careful not to free the OVERLAPPED structure while I/O requests are still pending; use GetOverlappedResult to determine the status of the I/O operation and wait for the operation to complete. The CancelIoEx function can optionally be used first to cancel outstanding I/O requests, potentially shortening the wait. For more information, see Canceling Pending I/O Operations.

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

CancelThreadpoolIo

CloseThreadpoolIo

CreateThreadpoolIo

StartThreadpoolIo

Thread Pools