Non-blocking pipes still appear to be isBlocking
Alan Bateman
Alan.Bateman at oracle.com
Tue Jan 30 07:12:04 UTC 2024
On 29/01/2024 22:09, Charles Oliver Nutter wrote:
> :
>
> (And yes, I know the implications for vthreads; this is for a user
> with legacy code expecting child process pipe streams to be blocking
> by default.)
>
The source/sink ends of a Pipe are selectable channels and can therefore
be configured non-blocking. I wonder if the user's code chokes with
usages like this:
pipe.source().configureBlocking(false);
pipe.sink().configureBlocking(false);
As regards the underlying blocking mode: It's okay for a
SelectableChannel to implement blocking semantics when then underlying
socket/fifo is configured non-blocking. Mostly they are the equal,
meaning if the SelectableChannel blocking mode is true then the
underlying socket/fifo's blocking mode is also true. For the network
channels, the first use of a virtual thread will change the channel's
socket to be non-blocking. The pipe channels are a bit different in that
they eagerly change the underlying fifo to be non-blocking. Both are
valid approaches as it's transparent to anything using the API. The pipe
channel could be changed to work like the network channels and change it
lazily, I think they were only done this week for expediency rather than
anything else.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20240130/7d2072b1/attachment-0001.htm>
More information about the loom-dev
mailing list