]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid 100% CPU utilization on ssh session exit.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Aug 2014 21:31:18 +0000 (14:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Aug 2014 21:31:18 +0000 (14:31 -0700)
* src/xterm.h (struct x_display_info): New member 'connection'.
* src/xterm.c (x_term_init, x_delete_terminal): Set and use it,
so that x_delete_terminal has a file descriptor to pass to
delete_keyboard_wait_descriptor.

Fixes: debbugs:17691
src/ChangeLog
src/xterm.c
src/xterm.h

index 13415734c798530372edbd181b5ad5417cac3a8f..b85aee0d35a9482fdf1859805d672f3100d21db0 100644 (file)
@@ -1,3 +1,11 @@
+2014-08-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Avoid 100% CPU utilization on ssh session exit (Bug#17691).
+       * xterm.h (struct x_display_info): New member 'connection'.
+       * xterm.c (x_term_init, x_delete_terminal): Set and use it,
+       so that x_delete_terminal has a file descriptor to pass to
+       delete_keyboard_wait_descriptor.
+
 2014-08-01  Eli Zaretskii  <eliz@gnu.org>
 
        Fix display of R2L lines when the last character fits only partially.
index ed98fb10b898c1107ced99bbf61c3ec34ff49fcc..7723f1af77fdc48c4ffa1fb24732014abaa518cc 100644 (file)
@@ -9932,6 +9932,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 
   dpyinfo->name_list_element = Fcons (display_name, Qnil);
   dpyinfo->display = dpy;
+  dpyinfo->connection = ConnectionNumber (dpyinfo->display);
 
   /* Set the name of the terminal. */
   terminal->name = xlispstrdup (display_name);
@@ -10360,7 +10361,6 @@ void
 x_delete_terminal (struct terminal *terminal)
 {
   struct x_display_info *dpyinfo = terminal->display_info.x;
-  int connection = -1;
 
   /* Protect against recursive calls.  delete_frame in
      delete_terminal calls us back when it deletes our last frame.  */
@@ -10379,8 +10379,6 @@ x_delete_terminal (struct terminal *terminal)
      and dpyinfo->display was set to 0 to indicate that.  */
   if (dpyinfo->display)
     {
-      connection = ConnectionNumber (dpyinfo->display);
-
       x_destroy_all_bitmaps (dpyinfo);
       XSetCloseDownMode (dpyinfo->display, DestroyAll);
 
@@ -10422,11 +10420,12 @@ x_delete_terminal (struct terminal *terminal)
     }
 
   /* No more input on this descriptor.  */
-  if (connection != -1)
-    delete_keyboard_wait_descriptor (connection);
+  if (0 <= dpyinfo->connection)
+    delete_keyboard_wait_descriptor (dpyinfo->connection);
 
   /* Mark as dead. */
   dpyinfo->display = NULL;
+  dpyinfo->connection = -1;
   x_delete_display (dpyinfo);
   unblock_input ();
 }
index 50df88cb592e044699a03c342ce398394d829676..2bed0d1d5d174847f4715e0da4eb7ea6dcbedcc4 100644 (file)
@@ -137,6 +137,9 @@ struct x_display_info
   /* This says how to access this display in Xlib.  */
   Display *display;
 
+  /* A connection number (file descriptor) for the display.  */
+  int connection;
+
   /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).  */
   Lisp_Object name_list_element;