W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1999

Re: Patch to stop some event loop madness

From: Raffaele Sena <raff@nuvomedia.com>
Date: Wed, 15 Dec 1999 16:13:28 -0800
Message-ID: <00fc01bf475a$60b58200$52c0a8c0@nuvomedia.com>
To: "Sam Couter" <eddie@topic.com.au>, <www-lib@w3.org>

> 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:35 GMT