Re: How to stop the event loop?

Jim_Ravan@avid.com wrote:
> 
> So then I assume a better way to code an AFTER filter to stop the event
> loop is:
> 
>      static int endRequest(HTRequest* req, HTResponse* res,
>                          void* param, int status) {
>           if (HTNet_isIdle())
>                HTEventList_stopLoop();
>           return HT_OK;
>      }

Yes, although the best is simply to keep track of your requests so that
you know what you have outstanding.
 
> In this case, will the AFTER filter be called more than once or should I
> return a value other than HT_OK if I want the AFTER filter to be called
> again?

The filter return value determines whether the filter chain is broken or
continued. HT_OK continues the next filters to be called, HT_ERROR stops
immediately. However, as you have registered yourself as the last filter
then it doesn't make a big difference.
 
> !>Btw, you can register your after filter as a global filter which may be
> !>easier if you are using it for all requests.
> 
> I specifically didn't do this because I didn't know what would happen when
> the AFTER filter was called on GETs (which don't require an event loop -
> correct?). What does happen?

No, they work as normal. GET requests don't prevent an eventloop just
like any other request type. The limitation is that PUT and POST can not
be used without an event loop. In fact, I prefer always using an event
loop.

Henrik

Received on Tuesday, 15 December 1998 01:52:18 UTC