Author: mturk
Date: Thu Apr  6 06:38:26 2006
New Revision: 391984

URL: http://svn.apache.org/viewcvs?rev=391984&view=rev
Log:
Check for EINTR inside poll call. This will lower
the number of JNI calls in case EINTR is signaled.

Modified:
    tomcat/connectors/trunk/jni/native/src/poll.c

Modified: tomcat/connectors/trunk/jni/native/src/poll.c
URL: 
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/src/poll.c?rev=391984&r1=391983&r2=391984&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/poll.c (original)
+++ tomcat/connectors/trunk/jni/native/src/poll.c Thu Apr  6 06:38:26 2006
@@ -55,6 +55,7 @@
     int sp_poll_timeout;
     int sp_overflow;
     int sp_equals;
+    int sp_eintr;
 #endif
 } tcn_pollset_t;
 
@@ -75,6 +76,7 @@
     fprintf(stderr, "Maintained              : %d\n", p->sp_maintained);
     fprintf(stderr, "Max. maintained         : %d\n", p->sp_max_maintained);
     fprintf(stderr, "Number of duplicates    : %d\n", p->sp_equals);
+    fprintf(stderr, "Number of interrupts    : %d\n", p->sp_eintr);
 
 }
 
@@ -249,15 +251,25 @@
 #ifdef TCN_DO_STATISTICS
      p->sp_poll++;
 #endif
-    if ((rv = apr_pollset_poll(p->pollset, J2T(timeout), &num, &fd)) != 
APR_SUCCESS) {
-        TCN_ERROR_WRAP(rv);
+    for (;;) {
+        rv = apr_pollset_poll(p->pollset, J2T(timeout), &num, &fd);
+        if (rv != APR_SUCCESS) {
+            if (APR_STATUS_IS_EINTR(rv)) {
 #ifdef TCN_DO_STATISTICS
-        if (rv == TCN_TIMEUP)
-            p->sp_poll_timeout++;
-        else
-            p->sp_err_poll++;
+                p->sp_eintr++;
 #endif
-        num = (apr_int32_t)(-rv);
+                continue;
+            }
+            TCN_ERROR_WRAP(rv);
+#ifdef TCN_DO_STATISTICS
+            if (rv == TCN_TIMEUP)
+                p->sp_poll_timeout++;
+            else
+                p->sp_err_poll++;
+#endif
+            num = (apr_int32_t)(-rv);
+        }
+        break;
     }
     if (num > 0) {
 #ifdef TCN_DO_STATISTICS



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

Reply via email to