[PATCH 00/12] FIFO: fix multiple reader support

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Jul 16 19:57:15 GMT 2020


Hi Ken,

On Jul 16 12:19, Ken Brown via Cygwin-patches wrote:
> There were several flaws in my previous attempt to add support for
> explicitly opening a FIFO multiple times for reading.  (By
> "explicitly" I mean by calling open rather than by calling
> fork/exec/dup.)  See
> 
>   https://sourceware.org/pipermail/cygwin/2020-July/245456.html
> 
> for one indication of problems
> 
> The most important flaw was that I tried to use an indirect,
> unreliable method for determining whether there are writers open.
> This is fixed in the second patch of this series by adding a member
> '_nwriters' to struct fifo_shmem_t, which counts the number of open
> writers.
> 
> We now have to give writers access to the shared memory as well as
> readers, so that they can increment _nwriters in open/fork/exec/dup
> and decrement it in close.
> 
> The other patches contain miscellaneous fixes/improvements.
> 
> Ken Brown (12):
>   Cygwin: FIFO: fix problems finding new owner
>   Cygwin: FIFO: keep a writer count in shared memory
>   Cygwin: fhandler_fifo::hit_eof: improve reliability
>   Cygwin: FIFO: reduce I/O interleaving
>   Cygwin: FIFO: improve taking ownership in fifo_reader_thread
>   Cygwin: FIFO: fix indentation
>   Cygwin: FIFO: make certain errors non-fatal
>   Cygwin: FIFO: add missing lock
>   Cygwin: fhandler_fifo::take_ownership: don't set event unnecessarily
>   Cygwin: FIFO: allow take_ownership to be interrupted
>   Cygwin: FIFO: clean up
>   Cygwin: FIFO: update commentary
> 
>  winsup/cygwin/fhandler.h       |  55 +--
>  winsup/cygwin/fhandler_fifo.cc | 725 ++++++++++++++++++---------------
>  winsup/cygwin/select.cc        |  14 +-
>  3 files changed, 433 insertions(+), 361 deletions(-)

LGTM, please push.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


More information about the Cygwin-patches mailing list