public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe.
@ 2021-09-16 20:28 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2021-09-16 20:28 UTC (permalink / raw)
  To: cygwin-cvs

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-16 20:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 20:28 [newlib-cygwin] Cygwin: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe Ken Brown

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).