Cygwin: Fix handling of wait pipe hangup by properly detecting EOF
On Linux, the POLLHUP poll(3) event is used to signal that the other end
of a pipe has been disconnected. Due to poor wording in the Single UNIX
Specification, differents UNIX implementation signal the EOF with
conflicting poll events [1].
This is the case on Cygwin. A pipe close sends the POLLIN poll(3) event.
The actual consumer implementation sees this has a wakeup for data
ready to be consumed. The current hangup handling leads to infinite looping
in the consumer because the hangup is never detected and the POLLIN event
is never cleared.
To fix this issue, the consumer must read on the pipe, check for EOF
(read(3) shall return 0 to indicate EOF) and proceed to force the POLLHUP
poll(3) event if this is indeed the case.
[1] - http://www.greenend.org.uk/rjk/tech/poll.html
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
This page took 0.025377 seconds and 4 git commands to generate.