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

Takashi Yano takashi.yano@nifty.ne.jp
Mon Sep 2 13:57:05 GMT 2024


On Mon, 2 Sep 2024 22:50:45 +0900
Takashi Yano wrote:
> On Mon, 2 Sep 2024 14:48:35 +0200 (CEST)
> Johannes Schindelin wrote:
> > That would potentially be a remedy, but I would worry that this design
> > takes a decidedly single-thread world-view. While that may be appropriate
> > in the context of the scenario described in the bug report, it may very
> > well be inappropriate for Cygwin in general.
> 
> In the first place, it is obvious that multiple threads writing and
> reading from the same pipe at the same time causes undefined behavior,
> regardless of whether the pipe mode is toggled or not, isn't it?

As for the current implementation, raw_read() is protected by a mutex,
so the results are somewhat predictable. However, raw_write() is not.
Should we add write_mtx also for raw_write()?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-patches mailing list