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 2015/12/21 17:48:53 UTC

svn commit: r1721212 - /tcl/rivet/trunk/src/mod_rivet/rivet_lazy_mpm.c

Author: mxmanghi
Date: Mon Dec 21 16:48:52 2015
New Revision: 1721212

URL: http://svn.apache.org/viewvc?rev=1721212&view=rev
Log:
fine tuning of the 2 mutexes communication mechanism

Modified:
    tcl/rivet/trunk/src/mod_rivet/rivet_lazy_mpm.c

Modified: tcl/rivet/trunk/src/mod_rivet/rivet_lazy_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/rivet_lazy_mpm.c?rev=1721212&r1=1721211&r2=1721212&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/rivet_lazy_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet/rivet_lazy_mpm.c Mon Dec 21 16:48:52 2015
@@ -62,6 +62,7 @@ typedef struct lazy_tcl_worker {
     request_rec*        r;
     int                 ctype;
     int                 ap_sts;
+    int                 nreqs;
 } lazy_tcl_worker;
 
 typedef struct vhost_iface {
@@ -87,11 +88,14 @@ static void* APR_THREAD_FUNC request_pro
 {
     lazy_tcl_worker* w = (lazy_tcl_worker*) data; 
 
+    w->nreqs = 0;
     do 
     {
+        char* page;
+
+        apr_thread_mutex_lock(w->mutex1);
         apr_queue_push(module_globals->mpm->vhosts[w->idx].queue,w);
         apr_atomic_inc32(module_globals->mpm->vhosts[w->idx].idle_threads_cnt);
-        apr_thread_mutex_lock(w->mutex1);
         do {
             apr_thread_cond_wait(w->condition1,w->mutex1);
         } while (w->status != init);
@@ -104,7 +108,12 @@ static void* APR_THREAD_FUNC request_pro
 
         ap_set_content_type(w->r,apr_pstrdup(w->r->pool,DEFAULT_HEADER_TYPE));
         ap_send_http_header(w->r);
-        ap_rwrite(apr_pstrdup(w->r->pool,BASIC_PAGE),strlen(BASIC_PAGE),w->r);
+        //ap_rwrite(apr_pstrdup(w->r->pool,BASIC_PAGE),strlen(BASIC_PAGE),w->r);
+
+        page = apr_psprintf(w->r->pool,"%s: vh %d, idle threads: %d, nreqs: %d",BASIC_PAGE,w->idx,
+                            (int) apr_atomic_read32(module_globals->mpm->vhosts[w->idx].idle_threads_cnt),++(w->nreqs));
+
+        ap_rwrite(page,strlen(page),w->r);
         ap_rflush(w->r);
 
         apr_thread_mutex_lock(w->mutex2);
@@ -117,7 +126,6 @@ static void* APR_THREAD_FUNC request_pro
         do {
             apr_thread_cond_wait(w->condition1,w->mutex1);
         } while (w->status == done);
-
         apr_thread_mutex_unlock(w->mutex1);
 
     } while (1);
@@ -171,6 +179,7 @@ void Lazy_MPM_ChildInit (apr_pool_t* poo
                     MOD_RIVET_QUEUE_SIZE,module_globals->pool) == APR_SUCCESS);
         
         create_worker(pool,vh);
+        create_worker(pool,vh);
     }
 }
 
@@ -206,6 +215,7 @@ int Lazy_MPM_Request (request_rec* r,riv
     w->r      = NULL;
     apr_thread_cond_signal(w->condition1);
     apr_thread_mutex_unlock(w->mutex1);
+
     return ap_sts;
 }
 



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