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: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe.
Date: Thu, 16 Sep 2021 20:28:05 +0000 (GMT)	[thread overview]
Message-ID: <20210916202805.91A563858C27@sourceware.org> (raw)

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

commit 9814cfd8f693f61e602a5436b3fd6502907bfb11
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Fri Sep 17 04:23:12 2021 +0900

    Cygwin: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe.
    
    - query_hdl and hdl_cnt_mtx are moved from fhandler_pipe_fifo to
      fhandler_pipe. Then reader_closed() is changed to virtual and
      overridden in fhandler_pipe.

Diff:
---
 winsup/cygwin/fhandler.h       | 27 +++++++++++++--------------
 winsup/cygwin/fhandler_pipe.cc |  2 +-
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 31edb1822..61113e698 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1175,26 +1175,13 @@ class fhandler_pipe_fifo: public fhandler_base
 {
  protected:
   size_t pipe_buf_size;
-  HANDLE query_hdl;
-  HANDLE hdl_cnt_mtx;
   virtual void release_select_sem (const char *) {};
 
  public:
   fhandler_pipe_fifo ();
 
-  HANDLE get_query_handle () const { return query_hdl; }
-  void close_query_handle ()
-  {
-    if (query_hdl)
-      {
-	CloseHandle (query_hdl);
-	query_hdl = NULL;
-      }
-  }
-  bool reader_closed ();
-
+  virtual bool reader_closed () { return false; };
   ssize_t __reg3 raw_write (const void *ptr, size_t len);
-
 };
 
 class fhandler_pipe: public fhandler_pipe_fifo
@@ -1202,6 +1189,8 @@ class fhandler_pipe: public fhandler_pipe_fifo
 private:
   HANDLE read_mtx;
   pid_t popen_pid;
+  HANDLE query_hdl;
+  HANDLE hdl_cnt_mtx;
   void release_select_sem (const char *);
 public:
   fhandler_pipe ();
@@ -1250,6 +1239,16 @@ public:
     return fh;
   }
   void set_pipe_non_blocking (bool nonblocking);
+  HANDLE get_query_handle () const { return query_hdl; }
+  void close_query_handle ()
+  {
+    if (query_hdl)
+      {
+	CloseHandle (query_hdl);
+	query_hdl = NULL;
+      }
+  }
+  bool reader_closed ();
 };
 
 #define CYGWIN_FIFO_PIPE_NAME_LEN     47
diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc
index 2068a943e..73ace3ac5 100644
--- a/winsup/cygwin/fhandler_pipe.cc
+++ b/winsup/cygwin/fhandler_pipe.cc
@@ -393,7 +393,7 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
 }
 
 bool
-fhandler_pipe_fifo::reader_closed ()
+fhandler_pipe::reader_closed ()
 {
   if (!query_hdl)
     return false;


                 reply	other threads:[~2021-09-16 20:28 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=20210916202805.91A563858C27@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).