Author: mturk
Date: Tue Oct  7 23:38:11 2008
New Revision: 702732

URL: http://svn.apache.org/viewvc?rev=702732&view=rev
Log:
Fix simple thread join. Thread can be closed before even initialized

Modified:
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c

Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=702732&r1=702731&r2=702732&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Tue Oct  7 23:38:11 
2008
@@ -234,8 +234,8 @@
 static apr_global_mutex_t *jk_log_lock = NULL;
 static char *jk_shm_file = NULL;
 static size_t jk_shm_size = 0;
-static int jk_watchdog_interval = 0;
-static int jk_watchdog_done = 0;
+static volatile int jk_watchdog_interval = 0;
+static volatile int jk_watchdog_running  = 0;
 
 /*
  * Worker stuff
@@ -2212,7 +2212,7 @@
     /* Force the watchdog thread exit */
     if (jk_watchdog_interval > 0) {
         jk_watchdog_interval = 0;
-        while (!jk_watchdog_done)
+        while (jk_watchdog_running)
             apr_sleep(apr_time_from_sec(1));
     }
     jk_shm_close();
@@ -2849,9 +2849,12 @@
         if (JK_IS_DEBUG_LEVEL(conf->log))
            jk_log(conf->log, JK_LOG_DEBUG,
                   "Watchdog thread running");
+        jk_watchdog_running = 1;
         wc_maintain(conf->log);
+        if (!jk_watchdog_interval)
+            break;
     }
-    jk_watchdog_done = 1;
+    jk_watchdog_running = 0;
     return NULL;
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to