emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: busyloop in sigchld_handler


From: YAMAMOTO Mitsuharu
Subject: Re: busyloop in sigchld_handler
Date: Mon, 26 Mar 2007 10:47:41 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.0.96 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

The following change (without a ChangeLog entry) made operations using
subprocesses really sluggish on Mac OS X.  Is it possible to restrict
the workaround to the relevant platforms?

                                     YAMAMOTO Mitsuharu
                                address@hidden

===================================================================
RCS file: /sources/emacs/emacs/src/process.c,v
retrieving revision 1.505
retrieving revision 1.506
diff -c -r1.505 -r1.506
*** emacs/src/process.c 2007/03/20 08:51:03     1.505
--- emacs/src/process.c 2007/03/25 03:03:40     1.506
***************
*** 6501,6517 ****
  #define WUNTRACED 0
  #endif /* no WUNTRACED */
        /* Keep trying to get a status until we get a definitive result.  */
!       while (1)
!       {
          errno = 0;
          pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
-         if (! (pid < 0 && errno == EINTR))
-           break;
-         /* Avoid a busyloop: wait3 is a system call, so we do not want
-            to prevent the kernel from actually sending SIGCHLD to emacs
-            by asking for it all the time.  */
-         sleep (1);
        }
  
        if (pid <= 0)
        {
--- 6501,6517 ----
  #define WUNTRACED 0
  #endif /* no WUNTRACED */
        /* Keep trying to get a status until we get a definitive result.  */
!       do
!         {
!         /* For some reason, this sleep() prevents Emacs from sending
!              loadavg to 5-8(!) for ~10 seconds.
!              See http://thread.gmane.org/gmane.emacs.devel/67722 or
!              http://www.google.com/search?q=busyloop+in+sigchld_handler */
!           sleep (1);
          errno = 0;
          pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
        }
+       while (pid < 0 && errno == EINTR);
  
        if (pid <= 0)
        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]