perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Foertsch <torsten.foert...@gmx.net>
Subject Re: Interpreter scope
Date Tue, 01 May 2007 17:16:36 GMT
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

Mime
View raw message