emacs-devel
[Top][All Lists]
Advanced

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

Re: busyloop in sigchld_handler


From: Kim F. Storm
Subject: Re: busyloop in sigchld_handler
Date: Wed, 28 Mar 2007 17:33:05 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux)

Andreas Schwab <address@hidden> writes:

> We should probably just remove the loop altogether.

The problem is not the loop, but that the first wait3 will take
"forever" without the preceding sleep.  Nobody have yet explained why.

>
> --- 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."
>
>

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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