从 GetQueuedCompletionStatus 解锁

Unblock From GetQueuedCompletionStatus

在程序终止期间,如何取消阻塞先前已被调用 GetQueuedCompletionStatus() 阻塞的线程?

您可以 post 使用 PostQueuedCompletionStatus API 调用向 IO 完成端口发送终止消息,或者使用 CloseHandle.[=20 简单地关闭 IOCP 句柄=]

If a call to GetQueuedCompletionStatus fails because the completion port handle associated with it is closed while the call is outstanding, the function returns FALSE, *lpOverlapped will be NULL, and GetLastError will return ERROR_ABANDONED_WAIT_0.