Subject: Re: bug#24091: 24.5; High CPU usage at startup while hidden

From: Eli Zaretskii <[email-masked]>
Date: Fri, 29 Jul 2016 08:46:22 +0300

> From: [email-masked]
> Date: Thu, 28 Jul 2016 21:45:55 -0400
> Cc: [email-masked], [email-masked]
> 
> I guess we would like Emacs to hit this case:
> 
>         /* If on another desktop, the deiconify/map may be ignored and the
>            frame never becomes visible.  XMonad does this.
>            Prevent an endless loop.  */
>         if (FRAME_ICONIFIED_P (f) &&  ++tries > 100)
>           break;
> 
> But it seems that FRAME_ICONIFIED_P is returning false, because I see
> that tries is never incremented.

The question is: what happens if you bypass that loop and let Emacs
proceed with startup?  Does it successfully finish the startup, or
does it error out or crash later on?

If the former, we need to find a way to detect this special situation,
and maybe bypass the loop altogether.  If the latter, we will either
need to find a way to avoid that subsequent crash, or continue
waiting, perhaps with some 'usleep' call in the loop, to avoid hogging
the CPU.

Thanks.