[PATCH] Cygwin: pipe: Restore blocking mode of read pipe on close()

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Sep 2 11:10:31 GMT 2024


On Aug 30 23:15, Takashi Yano wrote:
> If a cygwin app is executed from a non-cygwin app and the cygwin
> app exits, read pipe remains on non-blocking mode because of the
> commit fc691d0246b9. Due to this behaviour, the non-cygwin app
> cannot read the pipe correctly after that. With this patch, the
> blocking mode of the read pipe is stored into was_blocking_read_pipe
> on set_pipe_non_blocking() when the cygwin app starts and restored
> on close().

Looks ok to me, but it would be helpful if Johannes could test this as
well.

I just wonder if the whole code could be simplified, if we set
the pipe to non-blocking only temporarily while reading or writing,
while the pipe is blocking all the time otherwise:

- Create pipe blocking

- set_pipe_non_blocking(true);
  NtReadFile() or NtWriteFile();
  set_pipe_non_blocking(false)

How costly is it to call NtSetInformationFile(FilePipeInformation)
for each read/write?

Thanks,
Corinna


More information about the Cygwin-patches mailing list