Bojan Smojver
Tue, 22 Jul 2008 23:53:54 -0700
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