Re: Timeout bug in HTEvtLoop

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)
	        break;

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

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

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