You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2019/06/30 15:14:33 UTC

[tcl-rivet] 01/02: handling bridge shutdown

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch quattuor
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git

commit 1a91eced4b7a71d1c241ae8ada4a09a690b0d986
Author: Massimo Manghi <mx...@apache.org>
AuthorDate: Sun Jun 30 17:12:14 2019 +0200

    handling bridge shutdown
---
 src/mod_rivet_ng/rivet_worker_mpm.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mod_rivet_ng/rivet_worker_mpm.c b/src/mod_rivet_ng/rivet_worker_mpm.c
index 38443a3..988d81e 100644
--- a/src/mod_rivet_ng/rivet_worker_mpm.c
+++ b/src/mod_rivet_ng/rivet_worker_mpm.c
@@ -75,6 +75,8 @@ typedef struct mpm_bridge_status {
 #ifdef RIVET_SERIALIZE_HTTP_REQUESTS
     apr_thread_mutex_t* req_mutex;
 #endif
+    int                 skip_thread_on_exit;   /* To exclusively handle the *
+                                                * WorkerBridge_Shutdown     */
 } mpm_bridge_status;
 
 
@@ -128,13 +130,14 @@ enum
  */
 
 static
-void Worker_Bridge_Shutdown (int not_to_be_waited)
+void Worker_Bridge_Shutdown (void)
 {
     int                 waits;
     void*               v;
     handler_private*    thread_obj;
     apr_status_t        rv;
     apr_uint32_t        threads_to_stop;
+    int                 not_to_be_waited = module_globals->mpm->skip_thread_on_exit;
 
     apr_thread_mutex_lock(module_globals->mpm->job_mutex);
 
@@ -600,7 +603,8 @@ void Worker_Bridge_ChildInit (apr_pool_t* pool, server_rec* server)
     module_globals->mpm->workers            = NULL;
     module_globals->mpm->server_shutdown    = 0;
     //module_globals->mpm->exit_command       = 0;
-
+    module_globals->mpm->skip_thread_on_exit = 0;
+    
     /* We keep some atomic counters that could provide basic data for a workload balancer */
 
     module_globals->mpm->threads_count = (apr_uint32_t *) apr_pcalloc(pool,sizeof(apr_uint32_t));
@@ -783,10 +787,8 @@ apr_status_t Worker_Bridge_Finalize (void* data)
     apr_status_t  rv;
     apr_status_t  thread_status;
     server_rec* s = (server_rec*) data;
-    rivet_thread_private* private;
 
-    RIVET_PRIVATE_DATA(rivet_thread_key,private)
-    Worker_Bridge_Shutdown(private->thread_exit);
+    Worker_Bridge_Shutdown();
 
     rv = apr_thread_join (&thread_status,module_globals->mpm->supervisor);
     if (rv != APR_SUCCESS)
@@ -889,6 +891,7 @@ int Worker_Bridge_ExitHandler(rivet_thread_private* private)
 
     if (!private->running_conf->single_thread_exit)
     {
+        module_globals->mpm->skip_thread_on_exit = 1;
 
         /* We now tell the supervisor to terminate the Tcl worker thread pool to exit
          * and is sequence the whole process to shutdown by calling exit() */


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