Waits for outstanding I/O completion callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.
void WaitForThreadpoolIoCallbacks(
PTP_IO pio,
BOOL fCancelPendingCallbacks
)
pio
Type: PTP_IO
[in, out] A TP_IO structure that defines the I/O completion object. The CreateThreadpoolIo function returns this structure.
fCancelPendingCallbacks
Type: BOOL
[in] Indicates whether to cancel queued callbacks that have not yet started to execute.
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.
Header: Declared in threadpoolapiset.h.
Library: Use kernelx.lib.