apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject Re: Changing the order of cleanup for some core objects
Date Wed, 23 Jul 2008 06:52:52 GMT
On Tue, 2008-07-22 at 09:15 +0100, Joe Orton wrote:

> There is a design pattern (if you can call it that) in APR which is 
> important to maintain: object destructors must be implemented as, or 
> wrapped in, a pool cleanup, and must only ever be invoked by running 
> that cleanup.  You see that in most of the APR code.

I read this as:

Resource destructor is for cleaning non-pool resources (e.g. malloc()-ed
memory etc.). Everything else should simply register a cleanup against
resource pool, sub-pool etc., at the appropriate level.

If there are no non-pool resources, destructor is a no-op. My example
code (the one I used to test new reslist code) has:

static apr_status_t db_destroy(void *rsc,void *parms,apr_pool_t *pool){
  return APR_SUCCESS;
}

That's because I'm using APU DBD here to test, which is fully pooled.

-- 
Bojan


Mime
View raw message