perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@hyperreal.org
Subject cvs commit: modperl/t/docs startup.pl
Date Thu, 17 Sep 1998 23:07:29 GMT
dougm       98/09/17 16:07:28

  Modified:    .        Changes ToDo
               src/modules/perl Server.xs mod_perl.c mod_perl.h
               t/conf   httpd.conf.pl
               t/docs   startup.pl
  Log:
  added Apache::Server->register_cleanup method
  
  Revision  Changes    Path
  1.142     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.141
  retrieving revision 1.142
  diff -u -r1.141 -r1.142
  --- Changes	1998/09/17 19:16:02	1.141
  +++ Changes	1998/09/17 23:07:24	1.142
  @@ -8,6 +8,8 @@
   
   =item 1.15_01-dev
   
  +added Apache::Server->register_cleanup method
  +
   DYNAMIC=1 works again
   
   Apache::PerlRun will now save/restore %INC to cure problem with
  
  
  
  1.87      +0 -2      modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /export/home/cvs/modperl/ToDo,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- ToDo	1998/09/17 21:56:46	1.86
  +++ ToDo	1998/09/17 23:07:24	1.87
  @@ -3,8 +3,6 @@
                    (well, close to it anyhow)
   ---------------------------------------------------------------------------
   
  -- make Apache->server->register_cleanup work
  -
   - <Perl> should report failed config
   
   - $ENV{PATH}
  
  
  
  1.4       +42 -1     modperl/src/modules/perl/Server.xs
  
  Index: Server.xs
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/Server.xs,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Server.xs	1998/09/01 22:04:35	1.3
  +++ Server.xs	1998/09/17 23:07:25	1.4
  @@ -1,7 +1,48 @@
   #define CORE_PRIVATE 
   #include "mod_perl.h" 
   
  -MODULE = Apache::Server  PACKAGE = Apache::Server
  +typedef struct {
  +    request_rec *r;
  +    SV *cv;
  +    int refcnt;
  +} srv_cleanup_t;
  +
  +static void srv_cleanup_handler(void *data)
  +{
  +    srv_cleanup_t *srv = (srv_cleanup_t*)data;
  +    (void)acquire_mutex(mod_perl_mutex);
  +    perl_call_handler(srv->cv, srv->r, Nullav);
  +    if(srv->refcnt) SvREFCNT_dec(srv->cv);
  +    (void)release_mutex(mod_perl_mutex);
  +}
  +
  +static void ApacheServer_register_cleanup(SV *self, SV *cv)
  +{
  +    pool *p = perl_get_startup_pool();
  +    server_rec *s;
  +    srv_cleanup_t *srv = (srv_cleanup_t *)palloc(p, sizeof(srv_cleanup_t));
  +
  +    if(SvROK(self) && sv_derived_from(self, "Apache::Server")) 
  +        s = (server_rec *)SvIV((SV*)SvRV(self));
  +    else 
  +	s = perl_get_startup_server();
  +    srv->r = mp_fake_request_rec(s, p, "Apache::Server::register_cleanup");
  +    srv->cv = cv;
  +    if(SvREFCNT(srv->cv) == 1) {
  +	srv->refcnt = 1;
  +	SvREFCNT_inc(srv->cv);
  +    }
  +    else
  +	srv->refcnt = 0;
  +    register_cleanup(p, srv, srv_cleanup_handler, mod_perl_noop);
  +}
  +
  +MODULE = Apache::Server  PACKAGE = Apache::Server   PREFIX = ApacheServer_
  +
  +void
  +ApacheServer_register_cleanup(self, cv)
  +    SV *self
  +    SV *cv
   
   PROTOTYPES: DISABLE
   
  
  
  
  1.45      +4 -4      modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- mod_perl.c	1998/09/16 17:12:06	1.44
  +++ mod_perl.c	1998/09/17 23:07:26	1.45
  @@ -300,7 +300,7 @@
       MP_TRACE_g(fprintf(stderr, "ok\n"));
   }
   
  -static request_rec *fake_request_rec(server_rec *s, pool *p, char *hook)
  +request_rec *mp_fake_request_rec(server_rec *s, pool *p, char *hook)
   {
       request_rec *r = (request_rec *)palloc(p, sizeof(request_rec));
       r->pool = p; 
  @@ -316,7 +316,7 @@
       char *hook = "PerlRestartHandler";
       dSTATUS;
       dPSRV(s);
  -    request_rec *r = fake_request_rec(s, p, hook);
  +    request_rec *r = mp_fake_request_rec(s, p, hook);
       PERL_CALLBACK(hook, cls->PerlRestartHandler);   
   }
   #endif
  @@ -713,7 +713,7 @@
       char *hook = "PerlChildInitHandler";
       dSTATUS;
       dPSRV(s);
  -    request_rec *r = fake_request_rec(s, p, hook);
  +    request_rec *r = mp_fake_request_rec(s, p, hook);
       server_hook_args *args = 
   	(server_hook_args *)palloc(p, sizeof(server_hook_args));
   
  @@ -732,7 +732,7 @@
       char *hook = "PerlChildExitHandler";
       dSTATUS;
       dPSRV(s);
  -    request_rec *r = fake_request_rec(s, p, hook);
  +    request_rec *r = mp_fake_request_rec(s, p, hook);
   
       PERL_CALLBACK(hook, cls->PerlChildExitHandler);
   
  
  
  
  1.49      +1 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- mod_perl.h	1998/09/17 16:34:12	1.48
  +++ mod_perl.h	1998/09/17 23:07:26	1.49
  @@ -963,6 +963,7 @@
   /* generic handler stuff */ 
   int perl_handler_ismethod(HV *class, char *sub);
   int perl_call_handler(SV *sv, request_rec *r, AV *args);
  +request_rec *mp_fake_request_rec(server_rec *s, pool *p, char *hook);
   
   /* stacked handler stuff */
   int mod_perl_push_handlers(SV *self, char *hook, SV *sub, AV *handlers);
  
  
  
  1.17      +4 -0      modperl/t/conf/httpd.conf.pl
  
  Index: httpd.conf.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/conf/httpd.conf.pl,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- httpd.conf.pl	1998/08/28 22:33:30	1.16
  +++ httpd.conf.pl	1998/09/17 23:07:27	1.17
  @@ -32,6 +32,10 @@
   use Apache ();
   use Apache::Registry ();
   
  +Apache::Server->register_cleanup(sub { 
  +    warn "Apache::Server registered cleanup called for $$\n";
  +});
  +
   if($ENV{TEST_PERL_DIRECTIVES}) {
       #t/TestDirectives/TestDirectives.pm
       push @INC, map { "t/TestDirectives/blib/$_" } qw(arch lib);
  
  
  
  1.20      +1 -0      modperl/t/docs/startup.pl
  
  Index: startup.pl
  ===================================================================
  RCS file: /export/home/cvs/modperl/t/docs/startup.pl,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- startup.pl	1998/09/17 16:34:14	1.19
  +++ startup.pl	1998/09/17 23:07:28	1.20
  @@ -20,6 +20,7 @@
       require Apache::PerlRunXS;
   }; $@ = '' if $@;
   
  +
   {
       last;
       Apache::warn("use Apache 'warn' is ok\n");
  
  
  

Mime
View raw message