You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Torsten Foertsch <to...@gmx.net> on 2007/05/01 19:16:36 UTC
Re: Interpreter scope
On Monday 23 April 2007 07:08, Philippe M. Chiasson wrote:
> > Is there something like $r->release_interp_after_this_phase()?
>
> Nope, but writing one would be very simple, all that's needed is
> to call
>
> MpInterpPUTBACK_On(interp)
>
apr_pool_cleanup_kill(r->pool, r, modperl_config_req_cleanup);
modperl_interp_pool_set(r->pool, NULL, 0);
interp->request=r;
MpInterpPUTBACK_On(interp);
MpReqCLEANUP_REGISTERED_On(rcfg);
I think this turns a per-request interpreter into a per-handler one. I have
attached a first version of an Apache2::Interpreter module that implements
$r->interpreter->release.
The most tricky part for me was to find the correct interp. Could you please
have a look at that? Maybe it could be done much simpler.
Also, the cleanup stuff is buggy as it is with scope==handler.
$r->pool->cleanup_register works by locking the interp until pool cleanup. It
thus blocks the interp from being reused. PerlCleanupHandler does not work at
all.
Torsten