Re: Patch to stop some event loop madness

> Short patch, to avoid infinite event loop madness when HTTimer_next() calls
> callbacks that call HTEventLoop_stopLoop().
> 
> If someone with CVS write access could check this in, I'd appreciate it.
> 
> diff -u -r2.41 HTEvtLst.c
> --- HTEvtLst.c  1999/07/07 15:43:28     2.41
> +++ HTEvtLst.c  1999/12/15 23:32:32
> @@ -664,6 +664,8 @@
>         wt = NULL;
>         if ((status = HTTimer_next(&timeout)))
>             break;
> +       if (HTEndLoop)
> +               break;
>         if (timeout != 0) {
>             waittime.tv_sec = timeout / MILLI_PER_SECOND;
>             waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
> 

Since there is already a check for HTEndLoop at the beginning of the loop:

    /* Don't leave this loop until we leave the application */
    while (!HTEndLoop) {

        /*
        **  Timeval struct copy needed for linux, as it set the value to the
        **  remaining timeout while exiting the select. (and perhaps for
        **  other OS). Code borrowed from X server.
        */
        wt = NULL;
        if ((status = HTTimer_next(&timeout)))
            break;
        if (timeout != 0) {
            waittime.tv_sec = timeout / MILLI_PER_SECOND;
            waittime.tv_usec = (timeout % MILLI_PER_SECOND) *
                (1000000 / MILLI_PER_SECOND);
            wt = &waittime;
        }
        ...

can you explain me how your change fixes the problem, more that reducing
the time before the HTEndLoop is checked ? Just curious.

-- Raffaele

Received on Thursday, 16 December 1999 00:17:11 UTC