[PATCH fifo 0/8] Allow a FIFO to have multiple writers
Sat Mar 23 20:03:00 GMT 2019
On Mar 22 19:30, Ken Brown wrote:
> Currently a FIFO can have only one writer. A second attempt to open
> the FIFO for writing blocks while fhandler_fifo::open waits for the
> read_ready event to be signalled.
> This patch series tries to fix the problem by having the reader open
> multiple instances of the Windows named pipe underlying the FIFO.
> When the FIFO is opened for reading, a 'listen_client' thread is
> created that listens for clients (writers) to connect to the pipe. It
> creates new pipe instances as needed.
> fhandler_fifo::raw_read loops through the connected writers, checking
> for input.
> I've tested it by running the fifo client and server programs from
> Chapter 44 of the book "The Linux Programming Interface: Linux and
> UNIX System Programming Handbook" by Michael Kerrisk. (See
> https://cygwin.com/ml/cygwin/2015-03/msg00047.html for simplified
> versions of these programs.) These work as on Linux.
> I've also tried the test given in
> http://www.cygwin.org/ml/cygwin/2015-12/msg00311.html. It works as on
> Linux also.
> - Try to get the code to work for duplexers (FIFOs opened for reading
> and writing). I haven't thought about this at all yet.
> - Think about what it would take to allow multiple readers. I'm not
> very optimistic about this, but my impression is that the
> multiple-writer case is more important in practice.
> Ken Brown (8):
> Cygwin: FIFO: stop using overlapped I/O
> Cygwin: FIFO: allow multiple writers
> Cygwin: FIFO: add a spinlock
> Cygwin: FIFO: improve EOF detection
> Cygwin: FIFO: update clone and dup
> Cygwin: FIFO: update fixup_after_fork
> Cygwin: FIFO: update set_close_on_exec
> Cygwin: FIFO: update select
> winsup/cygwin/fhandler.h | 58 ++-
> winsup/cygwin/fhandler_fifo.cc | 732 +++++++++++++++++++++++++++------
> winsup/cygwin/select.cc | 161 +++++++-
> winsup/cygwin/select.h | 7 +
> 4 files changed, 819 insertions(+), 139 deletions(-)
Your patch series looks really good. For now I pushed it into the
topic/fifo branch as you suggested.
Just be aware that it won't get much 3rd party testing this way, so as
soon as you feel more confident, let's move it into master. At that
time I'll create a Cygwin 3.0.y branch for bugfix releases, but the
snapshots will continue to be created from master so we get at least
*some* folks testing it.
A big thank you already!
Oh, there's obviously a downside to this, too: You'll have to create
a release note for this change at one point ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: not available
More information about the Cygwin-patches