W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2000

Re: Timeout bug in HTEvtLoop

From: Sam Couter <sam@topic.com.au>
Date: Tue, 22 Feb 2000 11:21:24 +1100
To: Mike Flynn <flynn5@home.com>
Cc: www-lib@w3.org
Message-ID: <20000222112124.A11449@beethoven.tsa>
Mike Flynn <flynn5@home.com> wrote:
> As in all cases, either I've goofed up the example or I've uncovered a
> bug.

I'm having the same problem as you. I found what I believe is the cause, and
I call it a bug. Others don't seem to agree. :/

> I put an event timeout using the HTHost_setEventTimeout( int ) function,
> and I am able to catch the event in a cbf after the appropriate amount
> of time.   The problem occurs after the cbf as I want to break the event
> loop and return control to another part of my program.   The terminate
> handler calls the appropriate functions (from what I've seen in the
> examples) but the code in the EventLoop (HTEvtLoop.c) doesn't do any
> checking of the main loop variable that I've turned off with a call to
> HTEventList_stopLoop().  I just goes on to read from a socket that will
> never return anything.  It doesn't seem to matter what I return from the
> cbf...  All the example programs just do an exit().

Try adding these two lines to HTEvtLst.c, in function HTEventList_loop():

    if (HTEndLoop)

They go around line 671, right after these two lines:

    if ((status = HTTimer_next(&timeout)))

The HTTimer_next() call is calling your timeout function, which sets
HTEndLoop, but HTEndLoop is never chocked between the timer functions and
the select() call. Of course, select() will just wait forever if there are
no file descriptors ready.

Please let me know if this fixes your problem. It fixed mine.
Sam Couter                                              sam@topic.com.au
Internet Engineer                               http://www.topic.com.au/
tSA Consulting

Received on Monday, 21 February 2000 19:21:27 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC