perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/xs/Apache/Log Apache__Log.h
Date Fri, 10 Sep 2004 00:54:55 GMT
stas        2004/09/09 17:54:55

  Modified:    src/modules/perl modperl_util.c
               xs/Apache/Log Apache__Log.h
  Log:
  modperl_global_get_server_rec is not thread safe (there is only one global
  server and locking is needed to use it concurrently). at the moment make
  sure that threaded mpms won't try to use it after the server startup.
  
  Revision  Changes    Path
  1.82      +12 -2     modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -u -r1.81 -r1.82
  --- modperl_util.c	9 Sep 2004 23:00:19 -0000	1.81
  +++ modperl_util.c	10 Sep 2004 00:54:54 -0000	1.82
  @@ -90,9 +90,19 @@
       if (SvOBJECT(sv) || (SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG))) {
           return (server_rec *)SvObjIV(sv);
       }
  -    else {
  -        return modperl_global_get_server_rec();
  +    
  +    /* next see if we have Apache->request available */
  +    {
  +        request_rec *r = NULL;
  +        (void)modperl_tls_get_request_rec(&r);
  +        if (r) {
  +            return r->server;
  +        }
       }
  +    
  +    MP_CROAK_IF_THREADS_STARTED("using global server object");
  +    /* modperl_global_get_server_rec is not thread safe w/o locking */
  +    return modperl_global_get_server_rec();
   }
   
   MP_INLINE request_rec *modperl_sv2request_rec(pTHX_ SV *sv)
  
  
  
  1.20      +9 -1      modperl-2.0/xs/Apache/Log/Apache__Log.h
  
  Index: Apache__Log.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Log/Apache__Log.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -u -r1.19 -r1.20
  --- Apache__Log.h	9 Sep 2004 16:58:08 -0000	1.19
  +++ Apache__Log.h	10 Sep 2004 00:54:55 -0000	1.20
  @@ -44,6 +44,7 @@
           s = (server_rec *)SvObjIV(sv);
       }
       else {
  +        MP_CROAK_IF_THREADS_STARTED("using global server object");
           s = modperl_global_get_server_rec();
       }
   
  @@ -300,6 +301,7 @@
               s = (server_rec *)SvObjIV(ST(0));
           }
           else if (SvPOK(ST(0)) && strEQ(SvPVX(ST(0)), "Apache::ServerRec")) {
  +            MP_CROAK_IF_THREADS_STARTED("using global server object");
               s = modperl_global_get_server_rec();
           }
       }
  @@ -310,7 +312,13 @@
       else {
           request_rec *r = NULL;
           (void)modperl_tls_get_request_rec(&r);
  -        s = r ? r->server : modperl_global_get_server_rec();
  +        if (r) {
  +            s = r->server;
  +        }
  +        else {
  +            MP_CROAK_IF_THREADS_STARTED("using global server object");
  +            s = modperl_global_get_server_rec();
  +        }
       }
   
       if (items > 1+i) {
  
  
  

Mime
View raw message