Breaking ReadFile() blocking - Named Pipe (Windows API)

后端 未结 7 733
广开言路
广开言路 2020-12-30 23:43

To simplify, this is a situation where a NamedPipe SERVER is waiting for a NamedPipe CLIENT to write to the pipe (using WriteFile())

The Windows API that is blocking

7条回答
  •  灰色年华
    2020-12-31 00:03

    Take a look on CancelSynchronousIo

    Marks pending synchronous I/O operations that are issued by the specified thread as canceled.

    And CancelIo/CancelIoEx:

    To cancel all pending asynchronous I/O operations, use either:

    CancelIo — this function only cancels operations issued by the calling thread for the specified file handle.

    CancelIoEx — this function cancels all operations issued by the threads for the specified file handle.

    • http://msdn.microsoft.com/en-us/library/aa363794(VS.85).aspx
    • http://msdn.microsoft.com/en-us/library/aa365467(VS.85).aspx

提交回复
热议问题