You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2018/04/09 09:45:40 UTC

svn commit: r1828688 - in /tcl/rivet/trunk: ./ doc/xml/ src/mod_rivet_ng/

Author: mxmanghi
Date: Mon Apr  9 09:45:40 2018
New Revision: 1828688

URL: http://svn.apache.org/viewvc?rev=1828688&view=rev
Log:
    * src/mod_rivet_ng/mod_rivet.h: changing argument list of function
    *mpm_thread_interp in the bridge interface. It must work
    as an accessor to the interpreter database when both getting
    and storing an interpreter pointer


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/doc/xml/request.xml
    tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c
    tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c
    tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c
    tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h
    tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c
    tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c
    tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c
    tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c
    tcl/rivet/trunk/src/mod_rivet_ng/worker_prefork_common.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Mon Apr  9 09:45:40 2018
@@ -1,3 +1,9 @@
+2018-04-09 Massimo Manghi <mx...@apache.org>
+    * src/mod_rivet_ng/mod_rivet.h: changing argument list of function
+    *mpm_thread_interp in the bridge interface. It must work
+    as an accessor to the interpreter database when both getting
+    and storing an interpreter pointer
+
 2018-02-28 Massimo Manghi <mx...@apache.org>
     * Makefile.am: default_request_handler.tcl and init.tcl can be
     installed without the exec bit set

Modified: tcl/rivet/trunk/doc/xml/request.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/xml/request.xml?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/doc/xml/request.xml (original)
+++ tcl/rivet/trunk/doc/xml/request.xml Mon Apr  9 09:45:40 2018
@@ -13,9 +13,8 @@
        <para>
             Apache Rivet &version2-series; supported only the
             <ulink url="&apachedoc-prefork;">prefork</ulink>
-            MPM which creates full fledged child processes as independent agents 
-            responding to network requests. 
-            Starting with &version30; Also we the <ulink url="&apachedoc-worker;">worker</ulink> and
+            MPM which creates child processes as independent agents responding to network requests. 
+            Starting with &version30; also the <ulink url="&apachedoc-worker;">worker</ulink> and
             <ulink url="&apachedoc-event;">event</ulink> MPM are supported. The worker MPM is
             an hybrid model where forked child processes in turn create threads as real
             network agents. Also Apache on Windows&copy; is now supported and tested

Modified: tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/TclWebapache.c Mon Apr  9 09:45:40 2018
@@ -515,9 +515,9 @@ TclWeb_InitEnvVars (rivet_thread_private
     /* Here we create some variables with Rivet internal information. */
 
     apr_table_set (table, "RIVET_CACHE_FREE",
-            (char*) apr_psprintf (TCLWEBPOOL, "%d",RIVET_PEEK_INTERP(private,private->running_conf)->cache_free));
+            (char*) apr_psprintf (TCLWEBPOOL, "%d",(RIVET_PEEK_INTERP(private,private->running_conf))->cache_free));
     apr_table_set (table, "RIVET_CACHE_SIZE",
-            (char*) apr_psprintf (TCLWEBPOOL, "%d",RIVET_PEEK_INTERP(private,private->running_conf)->cache_size));
+            (char*) apr_psprintf (TCLWEBPOOL, "%d",(RIVET_PEEK_INTERP(private,private->running_conf))->cache_size));
 
     req->environment_set = 1;
 }

Modified: tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/apache_config.c Mon Apr  9 09:45:40 2018
@@ -272,31 +272,15 @@ Rivet_MergeDirConfigVars(apr_pool_t *p,
 {
     FILEDEBUGINFO;
 
-    /* TODO: conf assignement should be converted into a macro (already in mod_rivet.h) */
-    // RIVET_CONF_SELECT(new,base,add,rivet_child_init_script)
-
-    new->rivet_child_init_script = add->rivet_child_init_script ?
-        add->rivet_child_init_script : base->rivet_child_init_script;
-    new->rivet_child_exit_script = add->rivet_child_exit_script ?
-        add->rivet_child_exit_script : base->rivet_child_exit_script;
-    new->request_handler = add->request_handler ?
-        add->request_handler : base->request_handler;
-
-    new->rivet_before_script = add->rivet_before_script ?
-        add->rivet_before_script : base->rivet_before_script;
-    new->rivet_after_script = add->rivet_after_script ?
-        add->rivet_after_script : base->rivet_after_script;
-    new->rivet_error_script = add->rivet_error_script ?
-        add->rivet_error_script : base->rivet_error_script;
-    new->rivet_abort_script = add->rivet_abort_script ?
-        add->rivet_abort_script : base->rivet_abort_script;
-    new->after_every_script = add->after_every_script ?
-        add->after_every_script : base->after_every_script;
-
-    //new->user_scripts_updated = add->user_scripts_updated ?
-    //    add->user_scripts_updated : base->user_scripts_updated;
-
-    new->upload_dir = add->upload_dir ? add->upload_dir : base->upload_dir;
+    RIVET_CONF_SELECT(new,base,add,rivet_child_init_script)
+    RIVET_CONF_SELECT(new,base,add,rivet_child_exit_script)
+    RIVET_CONF_SELECT(new,base,add,request_handler)
+    RIVET_CONF_SELECT(new,base,add,rivet_before_script)
+    RIVET_CONF_SELECT(new,base,add,rivet_after_script)
+    RIVET_CONF_SELECT(new,base,add,rivet_error_script)
+    RIVET_CONF_SELECT(new,base,add,rivet_abort_script)
+    RIVET_CONF_SELECT(new,base,add,after_every_script)
+    RIVET_CONF_SELECT(new,base,add,upload_dir)
 
     /* Merge the tables of dir and user variables. */
     if (base->rivet_dir_vars && add->rivet_dir_vars) {

Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.c Mon Apr  9 09:45:40 2018
@@ -213,6 +213,7 @@ int Rivet_Exit_Handler(int code)
 /* 
  * -- Rivet_RunServerInit
  *
+ * 
  */
 
 static int
@@ -235,11 +236,11 @@ Rivet_RunServerInit (apr_pool_t *pPool,
 
     Rivet_PerInterpInit(module_globals->server_interp,NULL,s,pPool);
 
-	/* This code is to be included only if we are building for the
+	/* This code conditionally compiled when we are building for the
 	 * Windows family of OS. The winnt MPM runs the post_config 
 	 * hooks after it has spawned a child process but we don't want
 	 * to run the Tcl server initialization script again. We
-	 * detect we are running in the a child process checking
+	 * detect we are in a child process by checking
 	 * the environment variable AP_PARENT_PID 
 	 * (https://wiki.apache.org/httpd/ModuleLife)
 	 */
@@ -344,8 +345,8 @@ Rivet_ServerInit (apr_pool_t *pPool, apr
 
     if (apr_dso_load(&dso_handle,module_globals->rivet_mpm_bridge,pPool) == APR_SUCCESS)
     {
-        apr_status_t                rv;
-        apr_dso_handle_sym_t        func = NULL;
+        apr_status_t            rv;
+        apr_dso_handle_sym_t    func = NULL;
 
         ap_log_error(APLOG_MARK,APLOG_DEBUG,0,server,
                      "MPM bridge loaded: %s",module_globals->rivet_mpm_bridge);
@@ -359,15 +360,16 @@ Rivet_ServerInit (apr_pool_t *pPool, apr
         {
             char errorbuf[ERRORBUF_SZ];
 
-            ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, server, 
-                         MODNAME ": Error loading symbol bridge_jump_table: %s", 
-                         apr_dso_error(dso_handle,errorbuf,ERRORBUF_SZ));
+            ap_log_error (APLOG_MARK, APLOG_ERR, APR_EGENERAL, server, 
+                          MODNAME ": Error loading symbol bridge_jump_table: %s", 
+                          apr_dso_error(dso_handle,errorbuf,ERRORBUF_SZ));
             exit(1);   
         }
 
-        /* we require only mpm_request and mpm_master_interp to be defined */
+        /* we require only mpm_request and mpm_thread_interp to be defined */
 
         ap_assert(RIVET_MPM_BRIDGE_FUNCTION(mpm_request) != NULL);
+        ap_assert(RIVET_MPM_BRIDGE_FUNCTION(mpm_thread_interp) != NULL);
 
         apr_thread_mutex_create(&module_globals->pool_mutex, APR_THREAD_MUTEX_UNNESTED, pPool);
 

Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet.h Mon Apr  9 09:45:40 2018
@@ -169,13 +169,13 @@ typedef struct _rivet_thread_interp {
 
 typedef struct _thread_worker_private rivet_thread_private;
 
-typedef int  (RivetBridge_ServerInit)   (apr_pool_t*,apr_pool_t*,apr_pool_t*,server_rec*);
-typedef void (RivetBridge_ChildInit)    (apr_pool_t* pPool,server_rec* s);
-typedef int  (RivetBridge_Request)      (request_rec*,rivet_req_ctype);
-typedef apr_status_t (RivetBridge_Finalize)(void*);
-typedef rivet_thread_interp* (RivetBridge_Master_Interp) (void);
-typedef int  (RivetBridge_Exit_Handler) (int);
-typedef rivet_thread_interp* (RivetBridge_Thread_Interp)(rivet_thread_private*,rivet_server_conf *);
+typedef int                     (RivetBridge_ServerInit)    (apr_pool_t*,apr_pool_t*,apr_pool_t*,server_rec*);
+typedef void                    (RivetBridge_ChildInit)     (apr_pool_t* pPool,server_rec* s);
+typedef int                     (RivetBridge_Request)       (request_rec*,rivet_req_ctype);
+typedef apr_status_t            (RivetBridge_Finalize)      (void*);
+typedef rivet_thread_interp*    (RivetBridge_Master_Interp) (void);
+typedef int                     (RivetBridge_Exit_Handler)  (int);
+typedef rivet_thread_interp*    (RivetBridge_Thread_Interp) (rivet_thread_private*,rivet_server_conf *,rivet_thread_interp*);
 
 typedef struct _mpm_bridge_table {
     RivetBridge_ServerInit    *mpm_server_init;
@@ -312,7 +312,11 @@ Tcl_Obj* Rivet_CurrentServerRec (Tcl_Int
     (*module_globals->bridge_jump_table->fun)(__VA_ARGS__);\
 }
 
-#define RIVET_PEEK_INTERP (module_globals->bridge_jump_table->mpm_thread_interp)
+#define RIVET_PEEK_INTERP(thread_private,running_conf) \
+        (module_globals->bridge_jump_table->mpm_thread_interp)(thread_private,running_conf,NULL)
+
+#define RIVET_POKE_INTERP(thread_private,running_conf,interp) \
+        (module_globals->bridge_jump_table->mpm_thread_interp)(thread_private,running_conf,interp)
 
 #define RIVET_MPM_BRIDGE rivet_bridge_table bridge_jump_table =
 

Modified: tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/mod_rivet_common.c Mon Apr  9 09:45:40 2018
@@ -1,5 +1,5 @@
-/* -- mod_rivet_common.c - functions likely to be shared among 
- *                         different versions of mod_rivet.c 
+/* -- mod_rivet_common.c - functions likely to be shared among different 
+ *                         components of mod_rivet.c 
  */
 
 /*
@@ -292,12 +292,12 @@ void Rivet_PerInterpInit(rivet_thread_in
   * Returns a new rivet_thread_interp object with a new Tcl interpreter
   * configuration scripts and cache. The pool passed to Rivet_NewVHostInterp 
   *
-  *     Arguments: 
-  *       apr_pool_t* pool: a memory pool, it must be the private pool of a 
-  *       rivet_thread_private object (thread private)
+  * Arguments: 
+  *     apr_pool_t* pool: a memory pool, it must be the private pool of a 
+  *                         rivet_thread_private object (thread private)
   *
-  *   Returned value:
-  *       a rivet_thread_interp* record object
+  * Returned value:
+  *     a rivet_thread_interp* record object
   *
   */
 
@@ -310,7 +310,7 @@ rivet_thread_interp* Rivet_NewVHostInter
     
     rsc = RIVET_SERVER_CONF (server->module_config);
 
-    /* This calls needs the root server_rec just for logging purposes*/
+    /* This calls needs the root server_rec just for logging purposes */
 
     interp_obj->interp = Rivet_CreateTclInterp(server); 
 

Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivet_lazy_mpm.c Mon Apr  9 09:45:40 2018
@@ -168,7 +168,8 @@ static void* APR_THREAD_FUNC request_pro
 
     private->ext = apr_pcalloc(private->pool,sizeof(mpm_bridge_specific));
     private->ext->keep_going = 1;
-    private->ext->interp = Rivet_NewVHostInterp(private->pool,w->server);
+    //private->ext->interp = Rivet_NewVHostInterp(private->pool,w->server);
+    RIVET_POKE_INTERP(private,rsc,Rivet_NewVHostInterp(private->pool,w->server));
     private->ext->interp->channel = private->channel;
 
     /* The worker thread can respond to a single request at a time therefore 
@@ -187,7 +188,7 @@ static void* APR_THREAD_FUNC request_pro
     Rivet_PerInterpInit(private->ext->interp,private,w->server,private->pool);
     
     /* The child initialization is fired. Beware of the terminologic 
-     * trap: we inherited from prefork only modules the term 'child'
+     * trap: we inherited from fork capable systems the term 'child'
      * meaning 'child process'. In this case the child init actually
      * is a worker thread initialization, because in a threaded module
      * this is the agent playing the same role a child process plays
@@ -410,12 +411,16 @@ int Lazy_MPM_Request (request_rec* r,riv
     return ap_sts;
 }
 
-/* -- Lazy_MPM_Interp
+/* -- Lazy_MPM_Interp: lazy bridge accessor to the interpreter database
+ *
  */
 
-rivet_thread_interp* Lazy_MPM_Interp(rivet_thread_private *private,
-                                     rivet_server_conf* conf)
+rivet_thread_interp* Lazy_MPM_Interp (rivet_thread_private* private,
+                                      rivet_server_conf*    conf,
+                                      rivet_thread_interp*  interp)
 {
+    if (interp != NULL) { private->ext->interp = interp; }
+
     return private->ext->interp;
 }
 
@@ -443,7 +448,7 @@ apr_status_t Lazy_MPM_Finalize (void* da
 
             while (!apr_is_empty_array(array)) 
             {
-                lazy_tcl_worker*    w;
+                lazy_tcl_worker* w;
 
                 w = *(lazy_tcl_worker**) apr_array_pop(array); 
                 apr_thread_mutex_lock(w->mutex);

Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivet_prefork_mpm.c Mon Apr  9 09:45:40 2018
@@ -54,7 +54,11 @@ apr_status_t Prefork_MPM_Finalize (void*
     return OK;
 }
 
-//int Prefork_MPM_ServerInit (apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, server_rec *s) { return OK; }
+
+/* -- Prefork_MPM_ChildInit: bridge child process initialization
+ *
+ */
+
 
 void Prefork_MPM_ChildInit (apr_pool_t* pool, server_rec* server)
 {
@@ -146,7 +150,7 @@ rivet_thread_interp* MPM_MasterInterp(se
      * calling a Tcl script fragment
      */
 
-    tcl_status = Tcl_Eval (module_globals->server_interp->interp,"expr {srand([clock clicks] + [pid])}");
+    tcl_status = Tcl_Eval(module_globals->server_interp->interp,"expr {srand([clock clicks] + [pid])}");
     if (tcl_status != TCL_OK)
     {
         ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, server, 
@@ -177,8 +181,12 @@ int Prefork_MPM_ExitHandler(int code)
     return TCL_OK;
 }
 
-rivet_thread_interp* Prefork_MPM_Interp(rivet_thread_private *private,rivet_server_conf* conf)
+rivet_thread_interp* Prefork_MPM_Interp (rivet_thread_private* private,
+                                         rivet_server_conf*    conf,
+                                         rivet_thread_interp*  interp)
 {
+    if (interp != NULL) { private->ext->interps[conf->idx] = interp; }
+
     return private->ext->interps[conf->idx];   
 }
 

Modified: tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/rivet_worker_mpm.c Mon Apr  9 09:45:40 2018
@@ -58,7 +58,6 @@ apr_threadkey_t*        handler_thread_k
 int round(double d) { return (int)(d + 0.5); }
 #endif /* RIVET_NO_HAVE_ROUND */
 
-
 rivet_thread_private*   Rivet_VirtualHostsInterps (rivet_thread_private* private);
 
 typedef struct mpm_bridge_status {
@@ -707,7 +706,6 @@ apr_status_t Worker_MPM_Finalize (void*
  *
  */
 
-
 rivet_thread_interp* MPM_MasterInterp(server_rec* s)
 {
     rivet_thread_private*   private;
@@ -716,7 +714,6 @@ rivet_thread_interp* MPM_MasterInterp(se
     RIVET_PRIVATE_DATA_NOT_NULL(rivet_thread_key,private)
 
     interp_obj = Rivet_NewVHostInterp(private->pool,s);
-    //interp_obj->channel = Rivet_CreateRivetChannel(private->pool,rivet_thread_key);
     interp_obj->channel = private->channel;
     Rivet_PerInterpInit(interp_obj, private, s, private->pool);
     return interp_obj;
@@ -760,9 +757,12 @@ int Worker_MPM_ExitHandler(int code)
     return TCL_OK;
 }
 
-rivet_thread_interp* Worker_MPM_Interp(rivet_thread_private *private,
-                                       rivet_server_conf *conf)
+rivet_thread_interp* Worker_MPM_Interp (rivet_thread_private* private,
+                                         rivet_server_conf*    conf,
+                                         rivet_thread_interp*  interp)
 {
+    if (interp != NULL) { private->ext->interps[conf->idx] = interp; }
+
     return private->ext->interps[conf->idx];   
 }
 

Modified: tcl/rivet/trunk/src/mod_rivet_ng/worker_prefork_common.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet_ng/worker_prefork_common.c?rev=1828688&r1=1828687&r2=1828688&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet_ng/worker_prefork_common.c (original)
+++ tcl/rivet/trunk/src/mod_rivet_ng/worker_prefork_common.c Mon Apr  9 09:45:40 2018
@@ -17,7 +17,7 @@
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
- */
+*/
 
 /* $Id$ */
 
@@ -99,10 +99,6 @@ rivet_thread_private* Rivet_VirtualHosts
     void*               function;
 
     root_server_conf = RIVET_SERVER_CONF (root_server->module_config);
-    
-    //ap_assert(RIVET_MPM_BRIDGE_FUNCTION(mpm_master_interp) != NULL);
-    //root_interp = (*RIVET_MPM_BRIDGE_FUNCTION(mpm_master_interp))();
-
     root_interp = MPM_MasterInterp(module_globals->server);
 
     /* we must assume the module was able to create the root interprter */ 
@@ -131,9 +127,7 @@ rivet_thread_private* Rivet_VirtualHosts
         Tcl_DecrRefCount(global_tcl_script);
     }
 
-    /* then we proceed assigning/creating the interpreters for the
-     * virtual hosts known to the server
-     */
+    /* then we proceed assigning/creating the interpreters for each virtual host */
 
     parentfunction = root_server_conf->rivet_child_init_script;
 
@@ -180,7 +174,9 @@ rivet_thread_private* Rivet_VirtualHosts
 
         rivet_interp->scripts = Rivet_RunningScripts (private->pool,rivet_interp->scripts,myrsc);
 
-        private->ext->interps[myrsc->idx] = rivet_interp;
+        //private->ext->interps[myrsc->idx] = rivet_interp;
+        
+        RIVET_POKE_INTERP(private,myrsc,rivet_interp);
 
         /* Basic Rivet packages and libraries are loaded here */
 
@@ -190,8 +186,8 @@ rivet_thread_private* Rivet_VirtualHosts
         }
 
         /* It seems that allocating from a shared APR memory pool is not thread safe,
-         * but it's not very well documented actually. I any case we protect this
-         * memory allcation with a mutex
+         * but it's not very well documented actually. In any case we protect this
+         * memory allocation with a mutex
          */
 
         /*  this stuff must be allocated from the module global pool which
@@ -215,17 +211,18 @@ rivet_thread_private* Rivet_VirtualHosts
             Tcl_IncrRefCount(tcl_child_init);
             Tcl_Preserve (interp);
 
-            /* There is a lot of passing around of pointers among various record 
-             * objects. We should understand if this is all that necessary.
+            /* There is a lot of passing pointers around among various structures. 
+             * We should understand if this is all that necessary.
              * Here we assign the server_rec pointer to the interpreter which
              * is wrong, because without separate interpreters it doens't make
              * any sense. TODO
              */
 
             /* before we run a script we have to store the pointer to the
-               running configuration in the thread private data. The design has
-               to improve and running a script must have everything sanely
-               prepared TODO */ 
+             * running configuration in the thread private data. The design has
+             * to improve and running a script must have everything sanely
+             * prepared TODO 
+             */ 
 
             private->running_conf = myrsc;
 
@@ -248,8 +245,9 @@ rivet_thread_private* Rivet_VirtualHosts
 /*
  * -- Rivet_ProcessorCleanup
  *
- * Thread private data cleanup. This function is called by MPM bridges to 
- * release data owned by private and pointed in the array of rivet_thread_interp
+ * Thread private data cleanup. This function was meant to be 
+ * called by the worker and prefork MPM bridges to release resources
+ * owned by thread private data and pointed in the array of rivet_thread_interp
  * objects. It has to be called just before an agent, either thread or
  * process, exits. We aren't calling this function anymore as we rely entirely
  * on the child process termination
@@ -271,15 +269,15 @@ rivet_thread_private* Rivet_VirtualHosts
 
 void Rivet_ProcessorCleanup (void *data)
 {
-    rivet_thread_private*   private = (rivet_thread_private *) data;
     int                     i;
+    rivet_thread_private*   private = (rivet_thread_private *) data;
     rivet_server_conf*      rsc = RIVET_SERVER_CONF(module_globals->server->module_config);
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, module_globals->server, 
                  "Thread exiting after %d requests served (%d vhosts)", 
                                         private->req_cnt,module_globals->vhosts_count);
 
-    /* We are deleting the interpreters and release the thread channel. 
+    /* We are about to delete the interpreters and release the thread channel. 
      * Rivet channel is set as stdout channel of Tcl and as such is treated
      * by Tcl_UnregisterChannel is a special way. When its refCount reaches 1
      * the channel is released immediately by forcing the refCount to 0
@@ -291,7 +289,8 @@ void Rivet_ProcessorCleanup (void *data)
     Tcl_SetStdChannel(NULL,TCL_STDOUT);
 
     /* there must be always a root interpreter in the slot 0 of private->interps,
-       so we always need to run this cycle at least onece */
+     * so we always need to run this cycle at least once 
+     */
 
     i = 0;
     do



---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org