apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Setting the pool cleanup order
Date Mon, 25 Sep 2006 09:43:48 GMT
Hi,

The current APR pool implementation destroys all child pools
before doing actual cleanup of registered objects.

I propose that we add the option that would mark the child pool
to be destroyed after all objects for that pool has been
destroyed.

Right now what we have on pool destroy/cleanup is:
1. destroy all child pools
2. call registered cleanups

I propose we extend that to:
1. destroy all child pools *not* marked as 'dormant'
2. call registered cleanups
3. destroy all child pools marked as 'dormant'


Here is the reason why we'd need something like that:

create P1 from global pool
create object O1 from P1
do forever {
   create pool P2 from P1
   create object O2 dependent on O1
   try {
     do something with O2
     destroy P2
   } catch on O2 error
     report the error
     destroy P2
   }
}

Now, this works perfectly in a single thread environment,
but in case the O1 can be destroyed while O2 is in the 'do something with O2'
we would have a core dump because O2 would fail (because its work
will be interrupted by the O1 cleanup) and P2 will already
be destroyed (P2 destroy was called by the P1 cleanup).

In case we could declare P2 as 'dormant' of P1 the 'destroy P2' would
not cause the core dump, because it would not be destroyed in advance.

Any comments?

Regards,
Mladen.









Mime
View raw message