geoff       2003/12/01 09:28:36

  Modified:    src/modules/perl mod_perl.c
               t/response/TestAPI query.pm
               t/response/TestAPR os.pm
               xs/Apache/MPM Apache__MPM.h
  Log:
  Apache::MPM->is_threaded() replaces Apache::MPM_IS_THREADED
  
  Revision  Changes    Path
  1.204     +0 -4      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.203
  retrieving revision 1.204
  diff -u -r1.203 -r1.204
  --- mod_perl.c        3 Nov 2003 23:31:19 -0000       1.203
  +++ mod_perl.c        1 Dec 2003 17:28:36 -0000       1.204
  @@ -52,7 +52,6 @@
   static void modperl_boot(pTHX_ void *data)
   {
       MP_dBOOT_DATA;
  -    MP_dSCFG(s);
       int i;
   
       modperl_env_clear(aTHX);
  @@ -70,9 +69,6 @@
   
       /* outside mod_perl this is done by ModPerl::Const.xs */
       newXS("ModPerl::Const::compile", XS_modperl_const_compile, __FILE__);
  -
  -    newCONSTSUB(PL_defstash, "Apache::MPM_IS_THREADED",
  -                newSViv(scfg->threaded_mpm));
   
   #ifdef MP_PERL_5_6_x
       /* make sure DynaLoader is loaded before XSLoader
  
  
  
  1.2       +35 -2     modperl-2.0/t/response/TestAPI/query.pm
  
  Index: query.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/query.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- query.pm  1 Dec 2003 17:14:16 -0000       1.1
  +++ query.pm  1 Dec 2003 17:28:36 -0000       1.2
  @@ -15,7 +15,7 @@
   
       my $r = shift;
   
  -    plan $r, tests => 3;
  +    plan $r, tests => 5;
   
       # ok, this isn't particularly pretty, but I can't think
       # of a better way to do it
  @@ -33,6 +33,16 @@
               ok t_cmp(Apache::MPMQ_NOT_SUPPORTED,
                        $query,
                        "MPMQ_IS_THREADED ($mpm)");
  +
  +            # is_threaded() is just a constsub set to the result from
  +            # ap_mpm_query(AP_MPMQ_IS_THREADED)
  +
  +            ok t_cmp($query,
  +                     Apache::MPM->is_threaded,
  +                     "Apache::MPM->is_threaded() equivalent to 
query(MPMQ_IS_THREADED)");
  +
  +            t_debug('Apache::MPM->is_threaded returned ' . 
Apache::MPM->is_threaded);
  +            ok (! Apache::MPM->is_threaded);
           }
   
           {
  @@ -50,8 +60,15 @@
               my $query = Apache::MPM->query(Apache::MPMQ_IS_THREADED);
   
               ok t_cmp(Apache::MPMQ_STATIC,
  -                     $query,
  +                    $query,
                        "MPMQ_IS_THREADED ($mpm)");
  +
  +            ok t_cmp($query,
  +                     Apache::MPM->is_threaded,
  +                     "Apache::MPM->is_threaded() equivalent to 
query(MPMQ_IS_THREADED)");
  +
  +            t_debug('Apache::MPM->is_threaded returned ' . 
Apache::MPM->is_threaded);
  +            ok (Apache::MPM->is_threaded);
           }
   
           {
  @@ -70,6 +87,13 @@
               ok t_cmp(Apache::MPMQ_STATIC,
                        $query,
                        "MPMQ_IS_THREADED ($mpm)");
  +
  +            ok t_cmp($query,
  +                     Apache::MPM->is_threaded,
  +                     "Apache::MPM->is_threaded() equivalent to 
query(MPMQ_IS_THREADED)");
  +
  +            t_debug('Apache::MPM->is_threaded returned ' . 
Apache::MPM->is_threaded);
  +            ok (Apache::MPM->is_threaded);
           }
   
           {
  @@ -88,6 +112,13 @@
               ok t_cmp(Apache::MPMQ_STATIC,
                        $query,
                        "MPMQ_IS_THREADED ($mpm)");
  +
  +            ok t_cmp($query,
  +                     Apache::MPM->is_threaded,
  +                     "Apache::MPM->is_threaded() equivalent to 
query(MPMQ_IS_THREADED)");
  +
  +            t_debug('Apache::MPM->is_threaded returned ' . 
Apache::MPM->is_threaded);
  +            ok (Apache::MPM->is_threaded);
           }
   
           {
  @@ -100,7 +131,9 @@
       }
       else {
           skip "skipping MPMQ_IS_THREADED test for $mpm MPM", 0;
  +        skip "skipping Apache::MPM->is_threaded equivalence test for $mpm MPM", 0;
           skip "skipping MPMQ_IS_FORKED test for $mpm MPM", 0;
  +        skip "skipping Apache::MPM->is_threaded test for $mpm MPM", 0;
       }
   
       # make sure that an undefined MPMQ constant yields undef
  
  
  
  1.4       +2 -1      modperl-2.0/t/response/TestAPR/os.pm
  
  Index: os.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/os.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- os.pm     23 May 2002 19:49:49 -0000      1.3
  +++ os.pm     1 Dec 2003 17:28:36 -0000       1.4
  @@ -6,6 +6,7 @@
   use Apache::Test;
   use Apache::TestUtil;
   
  +use Apache::MPM ();
   use APR::OS ();
   
   use Apache::Const -compile => 'OK';
  @@ -15,7 +16,7 @@
   
       plan $r, tests => 2;
   
  -    if (Apache::MPM_IS_THREADED) {
  +    if (Apache::MPM->is_threaded) {
           my $id = APR::OS::thread_current();
           ok t_cmp("$id", "$id", "current thread");
           ok t_cmp($$id, $$id, "current thread");
  
  
  
  1.3       +21 -2     modperl-2.0/xs/Apache/MPM/Apache__MPM.h
  
  Index: Apache__MPM.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/MPM/Apache__MPM.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Apache__MPM.h     1 Dec 2003 17:14:16 -0000       1.2
  +++ Apache__MPM.h     1 Dec 2003 17:28:36 -0000       1.3
  @@ -13,9 +13,28 @@
   
   static void mpxs_Apache__MPM_BOOT(pTHX)
   {
  -    /* implement Apache::MPM->show as a constant subroutine
  -     * since this information will never
  +    /* implement Apache::MPM->show and Apache::MPM->is_threaded
  +     * as constant subroutines, since this information will never
        * change during an interpreter's lifetime */
  +
  +    int mpm_query_info;
  +
  +    apr_status_t retval = ap_mpm_query(AP_MPMQ_IS_THREADED, &mpm_query_info);
  +
  +    if (retval == APR_SUCCESS) {
  +        MP_TRACE_g(MP_FUNC, "defined Apache::MPM->is_threaded() as %i\n", 
  +                   mpm_query_info);
  +
  +        newCONSTSUB(PL_defstash, "Apache::MPM::is_threaded",
  +                    newSViv(mpm_query_info));
  +    }
  +    else {
  +        /* assign false (0) to sub if ap_mpm_query didn't succeed */
  +        MP_TRACE_g(MP_FUNC, "defined Apache::MPM->is_threaded() as 0\n");
  +
  +        newCONSTSUB(PL_defstash, "Apache::MPM::is_threaded",
  +                    newSViv(0));
  +    }
   
       MP_TRACE_g(MP_FUNC, "defined Apache::MPM->show() as %s\n",
                  ap_show_mpm());
  
  
  

Reply via email to