Subject: [possible solution] Re: Cygwin Emacs-X uses 99% of cpu
From: Joe Buehler <[email-masked]>
To: [email-masked]
Date: Wed, 13 Nov 2002 15:11:09 -0500

Huang. wrote:

> run emacs under strace, when in 100% cpu, just repeats the following :
> (repeat)
>    106 202207420 [sig] emacs 1692 wait_sig: looping
>    128 202207548 [sig] emacs 1692 wait_sig: awake
>    108 202207656 [sig] emacs 1692 wait_sig: processing signal 14
>    129 202207785 [sig] emacs 1692 wait_sig: Got signal 14
>    105 202207890 [sig] emacs 1692 sig_handle: signal 14
>    123 202208013 [sig] emacs 1692 sig_handle: signal 14, about to call 
> 0x201240A4
>    108 202208121 [sig] emacs 1692 setup_handler: suspending mainthread
>    193 202208314 [sig] emacs 1692 interruptible: pc 0x77E7E8BB, h 
> 0x77E60000, interruptible 1, testvalid 1
>    149 202208463 [sig] emacs 1692 interruptible: pc 0x77E7E8BB, h 
> 0x77E60000, interruptible 0, testvalid 0
>    131 202208594 [sig] emacs 1692 setup_handler: couldn't send signal 14
>    117 202208711 [sig] emacs 1692 setup_handler: ResumeThread returned 1
>    125 202208836 [sig] emacs 1692 setup_handler: returning 0
>    106 202208942 [sig] emacs 1692 sig_handle: returning 0
> (repeat)

This may be something I ran into on a UNIX machine.  If someone wants to rebuild
emacs with the following patch, it might fix the problem.  My recollection regarding
this patch is that a periodic timer is being set up in emacs but there is a
timing problem with how it is initialized.

I will try and rebuild the Cygwin emacs package with this patch sometime tonight.

Joe Buehler

--- src/xterm.c	Sat Mar 16 05:34:56 2002
+++ src/xterm.c	Mon Oct 14 08:36:55 2002
@@ -14228,6 +14228,17 @@
  #endif
    }

+  /* Install an asynchronous timer that processes Xt timeout events
+     every 0.1s.  This is necessary because some widget sets use
+     timeouts internally, for example the LessTif menu bar, or the
+     Xaw3d scroll bar.  When Xt timouts aren't processed, these
+     widgets don't behave normally.  */
+  {
+    EMACS_TIME interval;
+    EMACS_SET_SECS_USECS (interval, 0, 100000);
+    start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
+  }
+
  #else /* not USE_X_TOOLKIT */
  #ifdef HAVE_X11R5
    XSetLocaleModifiers ("");
@@ -14678,17 +14689,6 @@
  			 XtCacheByDisplay, cvt_pixel_dtor);

    XtAppSetFallbackResources (Xt_app_con, Xt_default_resources);
-
-  /* Install an asynchronous timer that processes Xt timeout events
-     every 0.1s.  This is necessary because some widget sets use
-     timeouts internally, for example the LessTif menu bar, or the
-     Xaw3d scroll bar.  When Xt timouts aren't processed, these
-     widgets don't behave normally.  */
-  {
-    EMACS_TIME interval;
-    EMACS_SET_SECS_USECS (interval, 0, 100000);
-    start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0);
-  }
  #endif

  #ifdef USE_TOOLKIT_SCROLL_BARS

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/