Author: stas Date: Wed Dec 8 17:40:25 2004 New Revision: 111337 URL: http://svn.apache.org/viewcvs?view=rev&rev=111337 Log: new function server_shutdown_cleanup_register
Modified: perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod Modified: perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod Url: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod?view=diff&rev=111337&p1=perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod&r1=111336&p2=perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod&r2=111337 ============================================================================== --- perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod (original) +++ perl/modperl/docs/trunk/src/docs/2.0/api/Apache/ServerUtil.pod Wed Dec 8 17:40:25 2004 @@ -47,8 +47,7 @@ $s->method_register('NEWGET'); # register server shutdown callback - $base_server_pool = Apache::ServerUtil::base_server_pool(); - $base_server_pool->cleanup_register(sub { Apache::OK }); + Apache::ServerUtil::server_shutdown_register_cleanup(sub { Apache::OK }); # do something only when the server restarts my $cnt = Apache::ServerUtil::restart_count(); @@ -188,22 +187,25 @@ -=head2 C<base_server_pool> +=head2 C<server_shutdown_cleanup_register> -Get the base server pool object: +Register server shutdown cleanup callback: - $base_server_pool = Apache::ServerUtil::base_server_pool(); + Apache::ServerUtil::server_shutdown_cleanup_register($sub); =over 4 -=item ret: C<base_server_pool> -( C<L<APR::Pool object|docs::2.0::api::APR::Pool>> ) +=item arg1: C<$sub> ( CODE ref or SUB name ) + + + +=item ret: no return value =item since: 1.99_18 =back -This pool can be used to register a callback to be run once at the +This function can be used to register a callback to be run once at the server shutdown (compared to C<L<PerlChildExitHandler|docs::2.0::user::handlers::server/C_PerlChildExitHandler_>> which will execute the callback for each exiting child process). @@ -212,13 +214,12 @@ run every time the server shuts down (or restarts), run the following code at the server startup: - $base_server_pool = Apache::ServerUtil::base_server_pool(); - $base_server_pool->cleanup_register(\&do_my_cleanups); + Apache::ServerUtil::server_shutdown_cleanup_register(\&do_my_cleanups); It's necessary to run this code at the server startup (normally -F<startup.pl>. Cleanup handlers registered after the +F<startup.pl>. The function will croak if run after the C<L<PerlPostConfigHandler|docs::2.0::user::handlers::server/C_PerlPostConfigHandler_>> -phase will be silently ignored. +phase. Modified: perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod Url: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod?view=diff&rev=111337&p1=perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod&r1=111336&p2=perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod&r2=111337 ============================================================================== --- perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod (original) +++ perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod Wed Dec 8 17:40:25 2004 @@ -68,7 +68,7 @@ To run something at the server shutdown and restart use a cleanup handler registered on -C<L<base_server_pool()|docs::2.0::api::Apache::ServerUtil/C_base_server_pool_>> +C<L<server_shutdown_cleanup_register()|docs::2.0::api::Apache::ServerUtil/C_server_shutdown_cleanup_register_>> in F<startup.pl>: #PerlRequire startup.pl @@ -76,8 +76,7 @@ use APR::Pool (); warn "parent pid is $$\n"; - $base_server_pool = Apache::ServerUtil::base_server_pool(); - $base_server_pool->cleanup_register(\&cleanup); + Apache::ServerUtil::server_shutdown_cleanup_register((\&cleanup); sub cleanup { warn "server cleanup in $$\n" } This is usually useful when some server-wide cleanup should be Modified: perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod Url: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod?view=diff&rev=111337&p1=perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod&r1=111336&p2=perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod&r2=111337 ============================================================================== --- perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod (original) +++ perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod Wed Dec 8 17:40:25 2004 @@ -822,9 +822,9 @@ C<L<PerlChildExitHandler|docs::2.0::user::handlers::server/C_PerlChildExitHandler_>>. In order to register a cleanup handler to be run only once when the -main server (not each child process) shutsdown, you can register a -cleanup handler on the -C<L<base_server_pool()|docs::2.0::api::Apache::ServerUtil/C_base_server_pool_>>. +main server (not each child process) shuts down, you can register a +cleanup handler with +C<L<server_shutdown_cleanup_register()|docs::2.0::api::Apache::ServerUtil/C_server_shutdown_cleanup_register_>>. =head2 C<$s-E<gt>uid> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]