8200179: (se) More Selector cleanup
Alan Bateman
Alan.Bateman at oracle.com
Fri Mar 23 20:10:13 UTC 2018
On 23/03/2018 19:51, David Lloyd wrote:
> 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_.
>
Not usually, it would be better to obtain the layout from the platform
as done in the epoll and kqueue implementations. The poll based Selector
has got away with the above since JDK 1.4 and it wasn't on my list to
change as part of this update. So if the poll Selector lives on then I
agree this should be cleaned up too.
-Alan
More information about the nio-dev
mailing list