perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@locus.apache.org
Subject cvs commit: modperl-2.0/src/modules/perl mod_perl.c modperl_config.c modperl_config.h modperl_interp.c modperl_interp.h modperl_types.h
Date Sun, 16 Apr 2000 01:33:57 GMT
dougm       00/04/15 18:33:57

  Modified:    src/modules/perl mod_perl.c modperl_config.c
                        modperl_config.h modperl_interp.c modperl_interp.h
                        modperl_types.h
  Log:
  interpreter pool is only useful #ifdef USE_ITHREADS
  
  Revision  Changes    Path
  1.6       +3 -6      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_perl.c	2000/04/16 00:35:32	1.5
  +++ mod_perl.c	2000/04/16 01:33:56	1.6
  @@ -23,7 +23,7 @@
   
       perl_run(perl);
   
  -    modperl_interp_pool_init(s, p, perl);
  +    modperl_interp_init(s, p, perl);
   }
   
   void modperl_init(server_rec *s, ap_pool_t *p)
  @@ -46,17 +46,13 @@
   {
       /* XXX: should be pre_config hook or 1.xx logic */
       ap_hook_open_logs(modperl_hook_init, NULL, NULL, HOOK_MIDDLE);
  -
  -    /* XXX: should only bother selecting an interpreter
  -     * if one is needed for the request
  -     */
  -    ap_hook_post_read_request(modperl_interp_select, NULL, NULL, HOOK_FIRST);
   }
   
   static command_rec modperl_cmds[] = {  
   #ifdef MP_TRACE
       MP_SRV_CMD_TAKE1("PerlTrace", trace, "Trace level"),
   #endif
  +#ifdef USE_ITHREADS
       MP_SRV_CMD_TAKE1("PerlInterpStart", interp_start,
                        "Number of Perl interpreters to start"),
       MP_SRV_CMD_TAKE1("PerlInterpMax", interp_max,
  @@ -65,6 +61,7 @@
                        "Max number of spare Perl interpreters"),
       MP_SRV_CMD_TAKE1("PerlInterpMinSpare", interp_min_spare,
                        "Min number of spare Perl interpreters"),
  +#endif
       { NULL }, 
   }; 
   
  
  
  
  1.4       +11 -2     modperl-2.0/src/modules/perl/modperl_config.c
  
  Index: modperl_config.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_config.c	2000/04/16 00:53:33	1.3
  +++ modperl_config.c	2000/04/16 01:33:56	1.4
  @@ -19,6 +19,8 @@
   void *modperl_create_srv_config(ap_pool_t *p, server_rec *s)
   {
       modperl_srv_config_t *scfg = modperl_srv_config_new(p);
  +
  +#ifdef USE_ITHREADS
       scfg->interp_pool_cfg = 
           (modperl_interp_pool_config_t *)
           ap_pcalloc(p, sizeof(*scfg->interp_pool_cfg));
  @@ -29,6 +31,8 @@
       scfg->interp_pool_cfg->min_spare = 3;
       scfg->interp_pool_cfg->max = 5;
   
  +#endif /* USE_ITHREADS */
  +
       return scfg;
   }
   
  @@ -37,14 +41,16 @@
   
   void *modperl_merge_srv_config(ap_pool_t *p, void *basev, void *addv)
   {
  +#if 0
       modperl_srv_config_t
           *base = (modperl_srv_config_t *)basev,
           *add  = (modperl_srv_config_t *)addv,
           *mrg  = modperl_srv_config_new(p);
   
  -    merge_item(mip);
  -
       return mrg;
  +#else
  +    return basev;
  +#endif
   }
   
   #define MP_CONFIG_BOOTSTRAP(parms) \
  @@ -56,6 +62,7 @@
       return NULL;
   }
   
  +#ifdef USE_ITHREADS
   
   #define MP_IMP_INTERP_POOL_CFG(item) \
   const char *modperl_cmd_interp_##item(cmd_parms *parms, \
  @@ -74,3 +81,5 @@
   MP_IMP_INTERP_POOL_CFG(max);
   MP_IMP_INTERP_POOL_CFG(max_spare);
   MP_IMP_INTERP_POOL_CFG(min_spare);
  +
  +#endif /* USE_ITHREADS */
  
  
  
  1.5       +2 -0      modperl-2.0/src/modules/perl/modperl_config.h
  
  Index: modperl_config.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- modperl_config.h	2000/04/16 00:35:32	1.4
  +++ modperl_config.h	2000/04/16 01:33:56	1.5
  @@ -18,10 +18,12 @@
                                  void *dummy, char *arg)
   MP_DECLARE_SRV_CMD(trace);
   
  +#ifdef USE_ITHREADS
   MP_DECLARE_SRV_CMD(interp_start);
   MP_DECLARE_SRV_CMD(interp_max);
   MP_DECLARE_SRV_CMD(interp_max_spare);
   MP_DECLARE_SRV_CMD(interp_min_spare);
  +#endif
   
   #define MP_SRV_CMD_TAKE1(name, item, desc) \
       { name, modperl_cmd_##item, NULL, \
  
  
  
  1.6       +26 -4     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- modperl_interp.c	2000/04/16 00:35:32	1.5
  +++ modperl_interp.c	2000/04/16 01:33:56	1.6
  @@ -5,6 +5,8 @@
    * but it will do for proof-of-concept
    */
   
  +#ifdef USE_ITHREADS
  +
   modperl_interp_t *modperl_interp_new(ap_pool_t *p,
                                        modperl_interp_pool_t *mip,
                                        PerlInterpreter *perl)
  @@ -201,8 +203,8 @@
       MUTEX_UNLOCK(&mip->mip_lock);
   }
   
  -void modperl_interp_pool_init(server_rec *s, ap_pool_t *p,
  -                              PerlInterpreter *perl)
  +void modperl_interp_init(server_rec *s, ap_pool_t *p,
  +                         PerlInterpreter *perl)
   {
       pTHX;
       MP_dSCFG(s);
  @@ -218,13 +220,11 @@
       MUTEX_INIT(&mip->mip_lock);
       COND_INIT(&mip->available);
   
  -#ifdef USE_ITHREADS
       for (i=0; i<mip->cfg->start; i++) {
           modperl_interp_t *interp = modperl_interp_new(p, mip, perl);
   
           modperl_interp_pool_add(mip, interp);
       }
  -#endif
   
       MP_TRACE_i(MP_FUNC, "parent == 0x%lx "
                  "start=%d, max=%d, min_spare=%d, max_spare=%d\n",
  @@ -235,6 +235,12 @@
       ap_register_cleanup(p, (void*)mip,
                           modperl_interp_pool_destroy, ap_null_cleanup);
   
  +
  +    /* XXX: should only bother selecting an interpreter
  +     * if one is needed for the request
  +     */
  +    ap_hook_post_read_request(modperl_interp_select, NULL, NULL, HOOK_FIRST);
  +
       scfg->mip = mip;
   }
   
  @@ -291,3 +297,19 @@
   
       return OK;
   }
  +
  +#else
  +
  +void modperl_interp_init(server_rec *s, ap_pool_t *p,
  +                         PerlInterpreter *perl)
  +{
  +    MP_dSCFG(s);
  +    scfg->perl = perl;
  +}
  +
  +ap_status_t modperl_interp_cleanup(void *data)
  +{
  +    return APR_SUCCESS;
  +}
  +
  +#endif /* USE_ITHREADS */
  
  
  
  1.4       +9 -6      modperl-2.0/src/modules/perl/modperl_interp.h
  
  Index: modperl_interp.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_interp.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_interp.h	2000/04/15 22:43:10	1.3
  +++ modperl_interp.h	2000/04/16 01:33:56	1.4
  @@ -1,24 +1,25 @@
   #ifndef MODPERL_INTERP_H
   #define MODPERL_INTERP_H
   
  +void modperl_interp_init(server_rec *s, ap_pool_t *p,
  +                         PerlInterpreter *perl);
  +
  +ap_status_t modperl_interp_cleanup(void *data);
  +
  +#ifdef USE_ITHREADS
  +
   modperl_interp_t *modperl_interp_new(ap_pool_t *p,
                                        modperl_interp_pool_t *mip,
                                        PerlInterpreter *perl);
   
   void modperl_interp_destroy(modperl_interp_t *interp);
   
  -ap_status_t modperl_interp_cleanup(void *data);
  -
   modperl_interp_t *modperl_interp_get(server_rec *s);
   
   ap_status_t modperl_interp_unselect(void *data);
   
   int modperl_interp_select(request_rec *r);
   
  -
  -void modperl_interp_pool_init(server_rec *s, ap_pool_t *p,
  -                              PerlInterpreter *perl);
  -
   ap_status_t modperl_interp_pool_destroy(void *data);
   
   void modperl_interp_pool_add(modperl_interp_pool_t *mip,
  @@ -26,5 +27,7 @@
   
   void modperl_interp_pool_remove(modperl_interp_pool_t *mip,
                                   modperl_interp_t *interp);
  +
  +#endif
   
   #endif /* MODPERL_INTERP_H */
  
  
  
  1.5       +8 -0      modperl-2.0/src/modules/perl/modperl_types.h
  
  Index: modperl_types.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- modperl_types.h	2000/04/16 00:35:32	1.4
  +++ modperl_types.h	2000/04/16 01:33:56	1.5
  @@ -23,6 +23,8 @@
   
   /* mod_perl structures */
   
  +#ifdef USE_ITHREADS
  +
   typedef struct modperl_interp_t modperl_interp_t;
   typedef struct modperl_interp_pool_t modperl_interp_pool_t;
   
  @@ -51,6 +53,8 @@
       modperl_interp_t *head, *tail;
   };
   
  +#endif /* USE_ITHREADS */
  +
   typedef struct {
       MpAV *handlers[MP_PROCESS_NUM_HANDLERS];
   } modperl_process_config_t;
  @@ -70,8 +74,12 @@
       MpAV *handlers[MP_PER_SRV_NUM_HANDLERS];
       modperl_process_config_t *process_cfg;
       modperl_connection_config_t *connection_cfg;
  +#ifdef USE_ITHREADS
       modperl_interp_pool_t *mip;
       modperl_interp_pool_config_t *interp_pool_cfg;
  +#else
  +    PerlInterpreter *perl;
  +#endif
       int flags;
   } modperl_srv_config_t;
   
  
  
  

Mime
View raw message