I noticed browsing some code that there is a threaded_mpm field in mp's server config structure.

That is a global proprety and doesn't have to live in the server config, so this patches replaces
that code with the (already there, but not used) threaded_mpm global.

It doesn't make a significant speed/memory improvement, but it removes a bit of unnecessary
logic.


Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.220
diff -u -I$Id -r1.220 mod_perl.c
--- src/modules/perl/mod_perl.c	7 Aug 2004 02:52:08 -0000	1.220
+++ src/modules/perl/mod_perl.c	17 Sep 2004 19:16:50 -0000
@@ -397,7 +397,7 @@
                                    base_server->server_hostname));
 
 #ifndef USE_ITHREADS
-    if (base_scfg->threaded_mpm) {
+    if (MP_MPM_IS_THREADED) {
         ap_log_error(APLOG_MARK, APLOG_ERR, 0, base_server,
                      "cannot use threaded MPM without ithreads enabled Perl");
         exit(1);
@@ -428,7 +428,7 @@
     char *base_name = modperl_server_desc(s, p);
 #endif /* MP_TRACE */
 
-    if (!base_scfg->threaded_mpm) {
+    if (!MP_MPM_IS_THREADED) {
         MP_TRACE_i(MP_FUNC, "no clones created for non-threaded mpm\n");
         return;
     }
@@ -627,11 +627,9 @@
 static int modperl_hook_post_config_last(apr_pool_t *pconf, apr_pool_t *plog,
                                          apr_pool_t *ptemp, server_rec *s)
 {
-    MP_dSCFG(s);
-
     /* in the threaded environment, no server_rec/process_rec
      * modifications should be done beyond this point */
-    if (scfg->threaded_mpm) {
+    if (MP_MPM_IS_THREADED) {
         MP_threads_started = 1;
     }
     
Index: src/modules/perl/mod_perl.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
retrieving revision 1.68
diff -u -I$Id -r1.68 mod_perl.h
--- src/modules/perl/mod_perl.h	10 Jul 2004 00:36:19 -0000	1.68
+++ src/modules/perl/mod_perl.h	17 Sep 2004 19:16:50 -0000
@@ -26,6 +26,8 @@
 #define MP_THREADED (defined(USE_ITHREADS) && APR_HAS_THREADS)
 #endif
 
+#define MP_MPM_IS_THREADED (modperl_global_get_threaded_mpm())
+
 extern module AP_MODULE_DECLARE_DATA perl_module;
 
 #include "modperl_error.h"
Index: src/modules/perl/modperl_config.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
retrieving revision 1.81
diff -u -I$Id -r1.81 modperl_config.c
--- src/modules/perl/modperl_config.c	9 Sep 2004 22:39:11 -0000	1.81
+++ src/modules/perl/modperl_config.c	17 Sep 2004 19:16:51 -0000
@@ -260,8 +260,6 @@
 {
     modperl_config_srv_t *scfg = modperl_config_srv_new(p);
 
-    ap_mpm_query(AP_MPMQ_IS_THREADED, &scfg->threaded_mpm);
-
     if (!s->is_virtual) {
 
         /* give a chance to MOD_PERL_TRACE env var to set
@@ -335,7 +333,6 @@
     mrg->setvars = add->setvars;
     mrg->addvars = add->addvars;
 
-    merge_item(threaded_mpm);
     merge_item(server);
 
 #ifdef USE_ITHREADS
Index: src/modules/perl/modperl_interp.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.c,v
retrieving revision 1.62
diff -u -I$Id -r1.62 modperl_interp.c
--- src/modules/perl/modperl_interp.c	29 Apr 2004 22:06:55 -0000	1.62
+++ src/modules/perl/modperl_interp.c	17 Sep 2004 19:16:51 -0000
@@ -248,7 +248,7 @@
 
     MP_TRACE_i(MP_FUNC, "server=%s\n", modperl_server_desc(s, p));
     
-    if (scfg->threaded_mpm) {
+    if (MP_MPM_IS_THREADED) {
         mip->tipool = modperl_tipool_new(p, scfg->interp_pool_cfg,
                                          &interp_pool_func, mip);
     }
@@ -341,7 +341,7 @@
     MP_dSCFG(s);
     modperl_interp_t *interp = NULL;
 
-    if (scfg && (is_startup || !scfg->threaded_mpm)) {
+    if (scfg && (is_startup || !MP_MPM_IS_THREADED)) {
         MP_TRACE_i(MP_FUNC, "using parent interpreter at %s\n",
                    is_startup ? "startup" : "request time (non-threaded MPM)");
 
@@ -383,7 +383,7 @@
     int is_subrequest = (r && r->main) ? 1 : 0;
     modperl_interp_scope_e scope;
 
-    if (!scfg->threaded_mpm) {
+    if (!MP_MPM_IS_THREADED) {
         MP_TRACE_i(MP_FUNC,
                    "using parent 0x%lx for non-threaded mpm (%s:%d)\n",
                    (unsigned long)scfg->mip->parent,
Index: src/modules/perl/modperl_types.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
retrieving revision 1.76
diff -u -I$Id -r1.76 modperl_types.h
--- src/modules/perl/modperl_types.h	18 Aug 2004 22:05:16 -0000	1.76
+++ src/modules/perl/modperl_types.h	17 Sep 2004 19:16:51 -0000
@@ -137,7 +137,6 @@
     MpAV *handlers_process[MP_HANDLER_NUM_PROCESS];
     MpAV *handlers_pre_connection[MP_HANDLER_NUM_PRE_CONNECTION];
     MpAV *handlers_connection[MP_HANDLER_NUM_CONNECTION];
-    int threaded_mpm;
 #ifdef USE_ITHREADS
     modperl_interp_pool_t *mip;
     modperl_tipool_config_t *interp_pool_cfg;

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to