Author: mturk
Date: Wed Aug 25 07:01:10 2010
New Revision: 988827

URL: http://svn.apache.org/viewvc?rev=988827&view=rev
Log:
Add native part of Poll.interrupt and a check if the APR has wakeable pollset 
support

Modified:
    tomcat/native/trunk/native/src/jnilib.c
    tomcat/native/trunk/native/src/poll.c

Modified: tomcat/native/trunk/native/src/jnilib.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/jnilib.c?rev=988827&r1=988826&r2=988827&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/jnilib.c (original)
+++ tomcat/native/trunk/native/src/jnilib.c Wed Aug 25 07:01:10 2010
@@ -25,6 +25,7 @@
 #include "apr_file_io.h"
 #include "apr_mmap.h"
 #include "apr_atomic.h"
+#include "apr_poll.h"
 
 #include "tcn_version.h"
 
@@ -427,6 +428,11 @@ TCN_IMPLEMENT_CALL(jboolean, Library, ha
             rv = JNI_TRUE;
 #endif
         break;
+        case 21:
+#if defined(APR_POLLSET_WAKEABLE)
+            rv = JNI_TRUE;
+#endif
+        break;
     }
     return rv;
 }

Modified: tomcat/native/trunk/native/src/poll.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/poll.c?rev=988827&r1=988826&r2=988827&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/poll.c (original)
+++ tomcat/native/trunk/native/src/poll.c Wed Aug 25 07:01:10 2010
@@ -108,6 +108,13 @@ TCN_IMPLEMENT_CALL(jlong, Poll, create)(
     UNREFERENCED(o);
     TCN_ASSERT(pool != 0);
 
+#if defined(APR_POLLSET_WAKEABLE)
+    /* By default all pollsets are wakeable.
+     * XXX: See if wee need to define that in Java API when calling this
+     *      method.
+     */
+    f |= APR_POLLSET_WAKEABLE;
+#endif
     if (f & APR_POLLSET_THREADSAFE) {
         apr_status_t rv = apr_pollset_create(&pollset, (apr_uint32_t)size, p, 
f);
         if (rv == APR_ENOTIMPL)
@@ -435,3 +442,27 @@ TCN_IMPLEMENT_CALL(jint, Poll, pollset)(
         (*e)->SetLongArrayRegion(e, set, 0, p->nelts * 2, p->set);
     return (jint)p->nelts;
 }
+
+#if defined(APR_POLLSET_WAKEABLE)
+
+TCN_IMPLEMENT_CALL(jint, Poll, interrupt)(TCN_STDARGS, jlong pollset)
+{
+    tcn_pollset_t *p = J2P(pollset,  tcn_pollset_t *);
+
+    UNREFERENCED(o);
+    TCN_ASSERT(pollset != 0);
+
+    return (jint)apr_pollset_wakeup(p->pollset);
+}
+#else
+
+TCN_IMPLEMENT_CALL(jint, Poll, interrupt)(TCN_STDARGS, jlong pollset)
+{
+
+    UNREFERENCED_STDARGS;
+    UNREFERENCED(pollset);
+
+    return APR_ENOTIMPL;
+}
+
+#endif



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

Reply via email to