WaitForThreadpoolIoCallbacks function

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

Syntax

void WaitForThreadpoolIoCallbacks(
  PTP_IO pio,
  BOOL   fCancelPendingCallbacks
);

Parameters

pio

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

fCancelPendingCallbacks

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

Return Value

This function does not return a value.

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

   
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 7, Windows Server 2008 Windows Server 2008 R2, Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

CancelThreadpoolIo

CloseThreadpoolIo

CreateThreadpoolIo

StartThreadpoolIo

Thread Pools