perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Grimm <edgr...@dsblade00.wat.us.ray.com>
Subject RE: Question re preloading embperl and apache shutdown
Date Thu, 24 Jul 2008 20:43:44 GMT
On Thu, 24 Jul 2008, Andrew O'Brien wrote:
> A start in apache is actually a start+restart IIRC. Could that be what
> you're seeing? I posted this a few days back but perhaps it was lost
> in the noise. I've got the following in my startup.pl:
>
> use Apache2::ServerUtil;
> # We want to do this only when the sever restarts. (The start process
> # includes a restart). The below variable has a value of 1 during
> # server start/stop and a value greater than one during the second
> # phase of server starting and any graceful restart.
> if ( Apache2::ServerUtil::restart_count() > 1 ) {
>   # force load/initialise perl stuff
> }
>
> Are any of the following useful to you (even if you set a variable
> using the shutdown callback to forcibly stop the preload?) in
> Apache2::ServerUtil?
>
>    # register server shutdown callback
>    Apache2::ServerUtil::server_shutdown_register_cleanup(sub {
> Apache2::Const::OK });
>
>    # do something only when the server restarts
>    my $cnt = Apache2::ServerUtil::restart_count();
>    do_something_once() if $cnt > 1;

I suspect you probably mean

>    do_something_once() if $cnt == 1;

Otherwise, you're depending upon the double start behavior, which could
cause problems when someone decides to fix that bug.

Ed

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message