RFR: 8351458: (ch) Move preClose to UnixDispatcher
Michael McMahon
michaelm at openjdk.org
Tue Mar 11 08:47:52 UTC 2025
On Sun, 9 Mar 2025 09:10:15 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Network channels in blocking mode, and the NIO based SocketImpl, have to deal with async close when there are threads blocked on the channel. Virtual threads blocked on the channel need to be unparked. On Unix systems, platform threads blocked on the channel require the file descriptor to be dup'ed to a special file descriptor and the threads signalled.
>
> There is a bit of duplication in the implementation of the 5 channels, and in the SocketImpl. In addition, there is discussion on net-dev about an issue in AIX that will require allowing for signals to be queued (the current implementation does not require OS to support queuing of signals).
>
> We refactor this code so that the "prepare for close" is in one place, UnixDispatcher.
So, on Unix, the fd needs to be dup'ed and the native thread signalled. On Windows, the dup() operation does not happen, but the threads were being signalled previously, but not any more. Was that redundant previously?
-------------
PR Review: https://git.openjdk.org/jdk/pull/23956#pullrequestreview-2673423557
More information about the nio-dev
mailing list