apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: Changing the order of cleanup for some core objects
Date Mon, 21 Jul 2008 14:04:32 GMT
Joe Orton wrote:
> On Mon, Jul 21, 2008 at 01:12:13PM +0200, Mladen Turk wrote:
>> Joe Orton wrote:
>>> In the model where you have S allocated out of P, let's presume we also 
>>> have a subpool Q.
>>>
>>> If for some reason specific to the design of your application, you need 
>>> S to be closed before the destruction of Q, you can register a cleanup  
>>> against Q which does calls apr_socket_close(S).  That will give defined 
>>> behaviour.
>>>
>> That's fine, but then if I explicitly close the S I have to deregister
>> the cleanup for Q, close the S, and then register the cleanup for Q
>> again. That's how its done now in multiple places where APR is used.
> 
> So you're saying it is possible to achieve the desired behaviour with 
> APR today, but it's a bit of effort?  Why can't you encapsulate that 
> effort in a couple of (AFAICT trivial two-line) wrapper functions?
> 

Cannot do that. The user of the API needs to do that in it's code
and take an extra care about pool ordering, so instead of well defined
API, without pre_cleanup its pretty much 'howto'.

> You have to make a case why it is necessary to change the default 
> behaviour of APR objects.

I'm not saying to change default behavior, but to have an option
to change the behavior at runtime as applicable by the API user.

The pool logic is pretty much the core of the APR so it should
be more flexible thought.

Regards
-- 
^(TM)

Mime
View raw message