|
The canonical way of polling an i/o handle by requesting a zero-byte
read/write operation and then waiting on the event (or apc routine) that
was specified for that i/o operation fails to work on the writing end of
a byte-stream pipe. Specifically, the request completes immediately,
therefore not allowing us to employ it for a controlled poll operation.
Following this patch, the writing end of the pipe is opened with the
NT_FILE_SYNCHRONOUS_IO_ALERT flag set. With this flag set, zero-byte
writes block, which makes them perfectly suitable for a polling operation,
but less so for non-blocking i/o. With some effort, however, the latter
can be achieved and be both robust and reliable.
|