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 Wed, 23 Jul 2008 06:34:17 GMT
Bojan Smojver wrote:
> On Wed, 2008-07-23 at 16:12 +1000, Bojan Smojver wrote:
> 
>> Here is a rough sketch.
> 
> As Joe predicted, it even works when pool pointer is not reset.
> 

It doesn't ;)

> +
> +    res->pool = p;
> +    res->list = reslist;
> +    apr_pool_cleanup_register(p, res, res_clean, apr_pool_cleanup_null);
> +

You should really use apr_pool_pre_cleanup_register here.

If you create a socket for example in the constructor,
socket registers it's own cleanup. This cleanup will be run
*before* destructor meaning you are convicted to apr_socket_close,
and you cannot cleanly close the socket via shutdown, or send
some data upon destruction.
Also any sub pool created is destroyed before destructor is
called, so, the same story again, but with one level deeper.

Regards
-- 
^(TM)

Mime
View raw message