8200179: (se) More Selector cleanup

David Lloyd david.lloyd at redhat.com
Fri Mar 23 19:51:47 UTC 2018


I have a question, mostly for my own reference:

+    private static final short SIZE_POLLFD   = 8;
+    private static final short FD_OFFSET     = 0;
+    private static final short EVENT_OFFSET  = 4;
+    private static final short REVENT_OFFSET = 6;

Is it generally considered OK to assume that the C side has 4-byte
ints and 2-byte shorts?  It seems like that might be unsafe, though I
don't know of any specific cases where it actually _is_.

On Fri, Mar 23, 2018 at 10:59 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> This is another batch of cleanups to the Selector implementations.
>
> The poll based Selector has been in disrepair for some time. JDK-8142872
> attempted to exclude it from the build but it wasn't complete in that the
> poll wrapper class and the native methods are are still compiled. There is
> also some legacy debt from JDK 1.4 where part of the  implementation was
> compiled on Windows even though it was never usable there. Finally, several
> source files (both native and java) have been importing the wrapper class or
> its header file. The main change to the implementation is that is that
> changes to the interest ops are queued so it avoids all the issues with
> threads changing the poll array when not correctly synchronized with the
> selector. All tests are passing when configured to use this Selector. Once
> Magnus gets JDK-8200178 into jdk/jdk then we can look at excluding it on
> platforms where it is not needed.
>
> This patch also refactors the I/O port based Selector used on Solaris. The
> queuing of changes to the interest ops, and post poll re-queuing to
> re-associate file descriptors, is much simpler now.
>
> The webrev with the changes is here:
>    http://cr.openjdk.java.net/~alanb/8200179/webrev/index.html
>
> -Alan



-- 
- DML


More information about the nio-dev mailing list