cancelio

How to find out when CancelIo() is done?

ε祈祈猫儿з 提交于 2020-01-04 05:57:27
问题 CancelIo() is supposed to cancel all pending I/O operations associated with the calling thread. In my experience, CancelIo() sometimes cancels future I/O operations as well. Given: ReadFile(port, buffer, length, &bytesTransferred, overlapped); If I invoke CancelIo(port) immediately before the read, GetQueuedCompletionStatus() will block forever, never receiving the read operation. If I invoke CancelIo(port) immediately after the read, GetQueuedCompletionStatus() will return 0 with