perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl mod_perl.c mod_perl.h modperl_interp.c
Date Tue, 08 Jan 2002 01:13:29 GMT
dougm       02/01/07 17:13:29

  Modified:    src/modules/perl mod_perl.c mod_perl.h modperl_interp.c
  Log:
  fix so perl_destruct (and things like END blocks) are run in child
  processes when they are shutdown
  
  Revision  Changes    Path
  1.103     +30 -3     modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- mod_perl.c	6 Jan 2002 21:39:36 -0000	1.102
  +++ mod_perl.c	8 Jan 2002 01:13:28 -0000	1.103
  @@ -128,6 +128,20 @@
       SAVEDESTRUCTOR_X(modperl_boot, 0);
   }
   
  +/*
  + * the "server_pool" is a subpool of the parent pool (aka "pconf")
  + * this is where we register the cleanups that teardown the interpreter.
  + * the parent process will run the cleanups since server_pool is a subpool
  + * of pconf.  we manually clear the server_pool to run cleanups in the
  + * child processes
  + */
  +static apr_pool_t *server_pool = NULL;
  +
  +apr_pool_t *modperl_server_pool(void)
  +{
  +    return server_pool;
  +}
  +
   PerlInterpreter *modperl_startup(server_rec *s, apr_pool_t *p)
   {
       AV *endav;
  @@ -198,8 +212,8 @@
       }
   
   #ifndef USE_ITHREADS
  -    cdata = modperl_cleanup_data_new(p, (void*)perl);
  -    apr_pool_cleanup_register(p, cdata,
  +    cdata = modperl_cleanup_data_new(server_pool, (void*)perl);
  +    apr_pool_cleanup_register(server_pool, cdata,
                                 modperl_shutdown, apr_pool_cleanup_null);
   #endif
       
  @@ -380,8 +394,10 @@
   int modperl_hook_init(apr_pool_t *pconf, apr_pool_t *plog, 
                         apr_pool_t *ptemp, server_rec *s)
   {
  +    apr_pool_create(&server_pool, pconf);
  +
       modperl_sys_init();
  -    apr_pool_cleanup_register(pconf, NULL,
  +    apr_pool_cleanup_register(server_pool, NULL,
                                 modperl_sys_term, apr_pool_cleanup_null);
       modperl_init_globals(s, pconf);
       modperl_init(s, pconf);
  @@ -461,9 +477,20 @@
       return OK;
   }
   
  +static apr_status_t modperl_child_exit(void *data)
  +{
  +    apr_pool_clear(server_pool);
  +    server_pool = NULL;
  +
  +    return APR_SUCCESS;
  +}
  +
   static void modperl_hook_child_init(apr_pool_t *p, server_rec *s)
   {
       modperl_perl_init_ids_server(s);
  +
  +    apr_pool_cleanup_register(p, NULL, modperl_child_exit,
  +                              apr_pool_cleanup_null);
   }
   
   void modperl_register_hooks(apr_pool_t *p)
  
  
  
  1.40      +1 -0      modperl-2.0/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- mod_perl.h	24 Nov 2001 01:15:01 -0000	1.39
  +++ mod_perl.h	8 Jan 2002 01:13:28 -0000	1.40
  @@ -45,6 +45,7 @@
   void modperl_pre_config_handler(apr_pool_t *p, apr_pool_t *plog,
                                   apr_pool_t *ptemp);
   void modperl_register_hooks(apr_pool_t *p);
  +apr_pool_t *modperl_server_pool(void);
   PerlInterpreter *modperl_startup(server_rec *s, apr_pool_t *p);
   void xs_init(pTHXo);
   
  
  
  
  1.39      +2 -1      modperl-2.0/src/modules/perl/modperl_interp.c
  
  Index: modperl_interp.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- modperl_interp.c	5 Nov 2001 05:19:01 -0000	1.38
  +++ modperl_interp.c	8 Jan 2002 01:13:28 -0000	1.39
  @@ -191,6 +191,7 @@
   void modperl_interp_init(server_rec *s, apr_pool_t *p,
                            PerlInterpreter *perl)
   {
  +    apr_pool_t *server_pool = modperl_server_pool();
       pTHX;
       MP_dSCFG(s);
   
  @@ -210,7 +211,7 @@
       /* this happens post-config in mod_perl.c:modperl_init_clones() */
       /* modperl_tipool_init(tipool); */
   
  -    apr_pool_cleanup_register(p, (void*)mip,
  +    apr_pool_cleanup_register(server_pool, (void*)mip,
                                 modperl_interp_pool_destroy,
                                 apr_pool_cleanup_null);
   
  
  
  

Mime
View raw message