Re: functionality of HTEventRequestTerminate

"Daniel W Connolly" writes:

> I suggest the design used in the ILU runtime:

(which is a mainEventLoop() function and a stopMainEventLoop()
function, which causes the mainEventLoop() to stop after the current
interation)

Well, as I see it, the HTEvent_Loop can be stopped by either using:

(1) a library function which sets an internal library variable
(2) a user function which presumably checks some user variable, and
    returns true / false

I'm partial to (2), mostly because I find it cleaner in terms of where
it comes in the loop (it's intuitive where it's called) and it allows
for greater flexibility.

Then again, there's no reason why both can't exist:

PRIVATE quit_main_loop = 0;
typedef int HTEventLoopTermFunc();
PRIVATE HTEventLoopTermFunc *eventloop_termfunc;

PUBLIC HTEventLoop_Quit() {
    quit_main_loop = 1;
}

PUBLIC HTEvent_Loop() {
    quit_main_loop = 0;

    do {
	...
    } while (!quit_main_loop && 
		(!eventloop_termfunc || (*eventloop_termfunc)()));
}

-Erik

    

Received on Friday, 26 January 1996 05:19:30 UTC