public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: pty: Stop counting number of slaves attached to pseudo console.
Date: Mon, 25 May 2020 09:03:18 +0000 (GMT)	[thread overview]
Message-ID: <20200525090318.74A3C388E825@sourceware.org> (raw)

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

commit 8d7a5b39d2fa3fe009dfae3fe90d6d2e9962f98e
Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Date:   Mon May 25 17:49:08 2020 +0900

    Cygwin: pty: Stop counting number of slaves attached to pseudo console.
    
    - The number of slaves attached to pseudo console is used only for
      triggering redraw screen. Counting was not only needless, but also
      did not work as expected. This patch removes the code for counting.

Diff:
---
 winsup/cygwin/fhandler_tty.cc | 22 +++++-----------------
 winsup/cygwin/tty.cc          |  3 +--
 winsup/cygwin/tty.h           |  1 -
 3 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 5faf896e4..df08dd20a 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1019,8 +1019,6 @@ fhandler_pty_slave::close ()
   fhandler_pty_common::close ();
   if (!ForceCloseHandle (output_mutex))
     termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
-  if (pcon_attached_to == get_minor ())
-    get_ttyp ()->num_pcon_attached_slaves --;
   return 0;
 }
 
@@ -2924,21 +2922,11 @@ fhandler_pty_slave::fixup_after_attach (bool native_maybe, int fd_set)
     {
       if (fhandler_console::get_console_process_id (get_helper_process_id (),
 						    true))
-	{
-	  if (pcon_attached_to != get_minor ())
-	    {
-	      pcon_attached_to = get_minor ();
-	      init_console_handler (true);
-	    }
-	  /* Clear screen to synchronize pseudo console screen buffer
-	     with real terminal. This is necessary because pseudo
-	     console screen buffer is empty at start. */
-	  if (get_ttyp ()->num_pcon_attached_slaves == 0)
-	    /* Assume this is the first process using this pty slave. */
-	    get_ttyp ()->need_redraw_screen = true;
-
-	  get_ttyp ()->num_pcon_attached_slaves ++;
-	}
+	if (pcon_attached_to != get_minor ())
+	  {
+	    pcon_attached_to = get_minor ();
+	    init_console_handler (true);
+	  }
 
 #if 0 /* This is for debug only. */
       isHybrid = true;
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index 3fc46fb29..efdae4697 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -242,9 +242,8 @@ tty::init ()
   screen_alternated = false;
   mask_switch_to_pcon_in = false;
   pcon_pid = 0;
-  num_pcon_attached_slaves = 0;
   term_code_page = 0;
-  need_redraw_screen = false;
+  need_redraw_screen = true;
   fwd_done = NULL;
   pcon_last_time = 0;
   pcon_in_empty = true;
diff --git a/winsup/cygwin/tty.h b/winsup/cygwin/tty.h
index c4dd2e458..7d6fc8fef 100644
--- a/winsup/cygwin/tty.h
+++ b/winsup/cygwin/tty.h
@@ -103,7 +103,6 @@ private:
   bool screen_alternated;
   bool mask_switch_to_pcon_in;
   pid_t pcon_pid;
-  int num_pcon_attached_slaves;
   UINT term_code_page;
   bool need_redraw_screen;
   HANDLE fwd_done;


                 reply	other threads:[~2020-05-25  9:03 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=20200525090318.74A3C388E825@sourceware.org \
    --to=corinna@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).