public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: fhandler_fifo.cc: add commentary
Date: Sat, 01 Feb 2020 21:36:00 -0000	[thread overview]
Message-ID: <20200201213654.66743.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=279f230620d784c7df91dc5242f76427e706ded7

commit 279f230620d784c7df91dc5242f76427e706ded7
Author: Ken Brown <kbrown@cornell.edu>
Date:   Sat Feb 1 16:36:31 2020 -0500

    Cygwin: fhandler_fifo.cc: add commentary

Diff:
---
 winsup/cygwin/fhandler_fifo.cc | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index ef568f6..19cd0e5 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -22,6 +22,35 @@
 #include "ntdll.h"
 #include "cygwait.h"
 
+/*
+   Overview:
+
+     Currently a FIFO can be opened once for reading and multiple
+     times for writing.  Any attempt to open the FIFO a second time
+     for reading fails with EACCES (from STATUS_ACCESS_DENIED).
+
+     When a FIFO is opened for reading,
+     fhandler_fifo::create_pipe_instance is called to create the first
+     instance of a Windows named pipe server (Windows terminology).  A
+     "listen_client" thread is also started; it waits for pipe clients
+     (Windows terminology again) to connect.  This happens every time
+     a process opens the FIFO for writing.
+
+     The listen_client thread creates new instances of the pipe server
+     as needed, so that there is always an instance available for a
+     writer to connect to.
+
+     The reader maintains a list of "fifo_client_handlers", one for
+     each pipe instance.  A fifo_client_handler manages the connection
+     between the pipe instance and a writer connected to that pipe
+     instance.
+
+     TODO: Allow a FIFO to be opened multiple times for reading.
+     Maybe this could be done by using shared memory, so that all
+     readers could have access to the same list of writers.
+*/
+
+
 /* This is only to be used for writers.  When reading,
 STATUS_PIPE_EMPTY simply means there's no data to be read. */
 #define STATUS_PIPE_IS_CLOSED(status)	\


                 reply	other threads:[~2020-02-01 21:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200201213654.66743.qmail@sourceware.org \
    --to=kbrown@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).