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 Tue, 22 Jul 2008 09:11:31 GMT
Joe Orton wrote:
> Here's how I would do it:
> 0. create a subpool for the reslist as a whole, P 
> 1. create a subpool Qn of P for each resource Rn in the reslist code, 
> and pass that Qn to the constructor and destructor; store a reference 
> to Qn in the apr_res_t for Rn
> 2. register the resource destructor as a cleanup on Qn, for the
> corresponding resource Rn
> 3. destroy_resource(Rn) just destroys the Qn subpool
> 4. reslist_cleanup() no longer calls destroy_resource() on each 
> resource; it can rely on subpool destruction to do that
> 5. reslist_cleanup() is registered against P rather than the 
> passed-in pool
> 6. apr_reslist_destroy() just destroys P
> I can't see any cleanup ordering problems with that scheme.

If the user creates a subpool the problem will still be present because
this sub pool will be destroyed before the destructor is called.
Also any resource allocated from this pool will be destroyed in advance
to the destructor (since its registered first, it'll be called last),
while for apr_reslist_invalidate it won't.
Don't think that'll work.


View raw message