emacs-devel
[Top][All Lists]
Advanced

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

Re: busyloop in sigchld_handler


From: Andreas Schwab
Subject: Re: busyloop in sigchld_handler
Date: Wed, 28 Mar 2007 17:25:08 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux)

Chong Yidong <address@hidden> writes:

>> Do all platforms have usleep ?
>
> usleep is not in POSIX, so we can't assume it exists.
>
>> Otherwise, we need a check in configure and use
>>
>> #ifdef HAVE_USLEEP
>>     usleep(1000);
>> #endif
>
> ... or we could use nanosleep, which is in POSIX.

We should probably just remove the loop altogether.

--- process.c   28 Mär 2007 12:54:58 +0200      1.508
+++ process.c   28 Mär 2007 16:19:54 +0200      
@@ -6499,18 +6499,7 @@ sigchld_handler (signo)
 #ifndef WUNTRACED
 #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 */
-          usleep (1000);
-         errno = 0;
-         pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
-       }
-      while (pid < 0 && errno == EINTR);
+      pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
 
       if (pid <= 0)
        {

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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