tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r695784 - /tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
Date Tue, 16 Sep 2008 09:28:33 GMT
Author: mturk
Date: Tue Sep 16 02:28:33 2008
New Revision: 695784

URL: http://svn.apache.org/viewvc?rev=695784&view=rev
Log:
Use 100ms step for watchdog thread and wait until exited on shutdown

Modified:
    tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c

Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?rev=695784&r1=695783&r2=695784&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Tue Sep 16 02:28:33 2008
@@ -200,6 +200,7 @@
 static int   use_auth_notification_flags = 1;
 static int reject_unsafe = 0;
 static int watchdog_interval = 0;
+static HANDLE watchdog_handle = NULL;
 
 #define URI_SELECT_OPT_PARSED       0
 #define URI_SELECT_OPT_UNPARSED     1
@@ -1573,7 +1574,11 @@
 
     if (is_inited) {
         is_inited = JK_FALSE;
-
+        if (watchdog_handle) {
+            WaitForSingleObject(watchdog_handle, INFINITE);
+            CloseHandle(watchdog_handle);
+            watchdog_handle = NULL;
+        }
         if (is_mapread) {
             uri_worker_map_free(&uw_map, logger);
             is_mapread = JK_FALSE;
@@ -1655,12 +1660,18 @@
 
 static DWORD WINAPI watchdog_thread(void *param)
 {
+    int i;
     if (JK_IS_DEBUG_LEVEL(logger)) {
         jk_log(logger, JK_LOG_DEBUG,
-               "Watchdog thread initialized");
+               "Watchdog thread initialized with %u second interval",
+               watchdog_interval);
     }
     while (is_inited) {
-        Sleep(watchdog_interval * 1000);
+        for (i = 0; i < (watchdog_interval * 10); i++) {
+            if (!is_inited)
+                break;
+            Sleep(100);
+        }
         if (!is_inited)
             break;
         if (JK_IS_DEBUG_LEVEL(logger)) {
@@ -1669,6 +1680,10 @@
         }
         wc_maintain(logger);
     }
+    if (JK_IS_DEBUG_LEVEL(logger)) {
+        jk_log(logger, JK_LOG_DEBUG,
+               "Watchdog thread finished");
+    }
     return 0;
 }
 
@@ -1820,10 +1835,17 @@
             }
         }
     }
-    if (rc && watchdog_interval) {
-        HANDLE wt;
-        DWORD  wi;
-        wt = CreateThread(NULL, 0, watchdog_thread, NULL, 0, &wi);
+    if (rc) {
+        if (watchdog_interval) {
+            DWORD  wi;
+            watchdog_handle = CreateThread(NULL, 0, watchdog_thread,
+                                           NULL, 0, &wi);
+            if (!watchdog_handle) {
+                rc = GetLastError();
+                jk_log(logger, JK_LOG_ERROR, "Error creating Watchdog thread");
+                return rc;
+            }
+        }
         jk_log(logger, JK_LOG_INFO, "%s initialized", (VERSION_STRING) );
     }
     return rc;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message