[Prev][Next][Index][Thread]

Re: functionality of HTEventRequestTerminate



Henrik Frystyk Nielsen writes:

>> I've been digging around in the source, and so far I've been unable to
>> come up with anything resembling what I need --- which is some
>> callback / flag / thingy which, upon successfully loading a URL, quits
>> the HTEvent_Loop. As near as I can see, the various __DoUserCallback
>> calls will always return HT_OK unless a serious error, such as a
>> memory outage or something, occur.

> It would be reasonable to have a "event shutdown" function in the Event 
> manager that simply exits the event loop and returns control to the 
> application. Something like

> 	extern HTEvent_shutdown (void);

> How this exactly is going to be implemented depends on the event loop.

Here's one better, which I think may work. Currently, HTEvent_Loop
looks something like:

do {

} while (1);

Can this be changed to:

typedef int HTEventLoopTerminateFunc();

PRIVATE HTEventLoopTerminateFunc *tf;

...

do {

} while (!tf || *tf());


There would be some HTEventLoop_setTerminationFunc() call which would
set the term func. This would just be a function which wouldn't take
any arguments, or perhaps a request, and would specify whether or not
to terminate. Yes, it'll probably rely on a global variable somewhere,
but I think that's OK for the use (and thread-minded people can always
throw in a mutex).

-Erik



Follow-Ups: References: