Author: mturk
Date: Sun Jun  3 00:08:36 2007
New Revision: 543853

URL: http://svn.apache.org/viewvc?view=rev&rev=543853
Log:
Use initial zero timeout for select call. Patch provided by David McLaughlin.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_connect.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.c
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_connect.c?view=diff&rev=543853&r1=543852&r2=543853
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_connect.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_connect.c Sun Jun  3 00:08:36 
2007
@@ -654,15 +654,18 @@
     FD_ZERO(&fd);
     FD_SET(sock, &fd);
 
-    /* Wait one microsecond */
+    /* Initially test the socket without any blocking.
+     */
     tv.tv_sec  = 0;
-    tv.tv_usec = 1;
+    tv.tv_usec = 0;
 
     do {
         rc = select((int)sock + 1, &fd, NULL, NULL, &tv);
 #if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
         errno = WSAGetLastError() - WSABASEERR;
 #endif
+        /* Wait one microsecond on next select, if EINTR */
+        tv.tv_usec = 1;
     } while (rc == -1 && errno == EINTR);
 
     if (rc == 0) {

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=543853&r1=543852&r2=543853
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jun  3 
00:08:36 2007
@@ -28,6 +28,15 @@
   <subsection name="Native">
     <changelog>
       <fix>
+      Use initial zero timeout for jk_is_socket_connected. The resulting
+      detection is the same but offers a huge performance increase
+      with mod_jk. In most cases the Operating System does not favor
+      the 1 microsecond timeout, but it rather rounds that up to much
+      higher value (frequency of interrupt timer which on most systems
+      defaults to 100Hz).
+      Patch provided by David McLaughlin. (mturk)
+      </fix>
+      <fix>
       Always build with thread support, unless flag --enable-prefork
       is set during for configure. (rjung)
       </fix>



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

Reply via email to