Greetings all,

I've noticed that rxvt windows that are iconized or on different
virtual desktops ( I use fvwm2 as my window manager ), would
eventually start burning CPU cycles.  If I did a top, I might see 4
rxvt processes running at 18% each.  These instances of rxvt should
have been calm since nothing was needing work as far as I could tell.

Linux 'strace -p PID' showed frenzied looping through these system calls:

  select(5, [3 4], NULL, NULL, {0, 5000}) = 0 (Timeout)
  ioctl(3, FIONREAD, [0])                 = 0

Gdb revealed the loop as this:

  for (;;) {
      if (v_bufstr < v_bufptr)        /* output any pending chars */
      while (XPending(Xdisplay)) {    /* process pending X events */
          XProcessEvent(Xdisplay);
          if (cmdbuf_ptr < cmdbuf_endp)
      }
      while (XPending(Xdisplay)) {    /* process pending X events */
      if (scrollbar_isUp()) {
      FD_ZERO(&readfds);
      FD_SET(cmd_fd, &readfds);
      FD_SET(Xfd, &readfds);
      value.tv_usec = TIMEOUT_USEC;
      value.tv_sec = 0;
      quick_timeout = want_refresh || scrollbar_isUpDn();
      retval = select(num_fds, &readfds, NULL, NULL,
      if (FD_ISSET(cmd_fd, &readfds)) {
      if (retval == 0) {
          refresh_count = 0;
          refresh_limit = 1;
      if (want_refresh) {
          scrollbar_show(1);
          IMSendSpot();
  for (;;) {

The problem, as best I could tell, is that want_refresh was never
zeroed, which made quick_timeout always true.

This diff seems to fix it for me (also attached):

  --- rxvt-2.6.2/src/screen.c.org Sun Apr  9 19:32:20 2000
  +++ rxvt-2.6.2/src/screen.c     Sat Sep  2 09:38:43 2000
  @@ -2152,10 +2152,11 @@
   #endif
       int             (*draw_string) (), (*draw_image_string) ();
   
  -    if (type == NO_REFRESH)
  -       return;
  -    if (!TermWin.mapped)
  -       return;
  +
  +    if (!TermWin.mapped || type == NO_REFRESH) {
  +      want_refresh = 0;   /* screen is current */
  +      return;
  +    }
   
   /*
    * A: set up vars

Thanks,

- Tor

-- 
}    __o
}  _(\<._  Tor Perkins           Send me e-mail with subject "get
} (_)/ (_) 967915644@noidDoTnet  pgp key" for automatic response.
--- rxvt-2.6.2/src/screen.c.org Sun Apr  9 19:32:20 2000
+++ rxvt-2.6.2/src/screen.c     Sat Sep  2 09:38:43 2000
@@ -2152,10 +2152,11 @@
 #endif
     int             (*draw_string) (), (*draw_image_string) ();
 
-    if (type == NO_REFRESH)
-       return;
-    if (!TermWin.mapped)
-       return;
+
+    if (!TermWin.mapped || type == NO_REFRESH) {
+      want_refresh = 0;   /* screen is current */
+      return;
+    }
 
 /*
  * A: set up vars

Reply via email to