On Tue, 20 Dec 2022 11:09:39 GMT, Chris Hegarty <che...@openjdk.org> wrote:

>> I know that. But write should eventually make progress - even if it spins a 
>> few times. What's the point of having that JDK method explicitly state "may 
>> return 0" and then disregarding that as something that is an exceptional 
>> scenario? I don't see the consistency here... If it can return zero, fine - 
>> handle it by retrying. If this code falls into a spin loop and never makes 
>> progress - this would be a problem somewhere else (perhaps in the 
>> implementation of the file channel), not here.
>
> I'm on the fence a little on this point. I really dislike the potential for a 
> busy loop, but also don't want the added complication of retry/backoff in 
> this loop. But really the latter is the right solution. lemme see how it 
> looks.

Don't get me wrong - you folks are much deeper into low-level details than I am 
so perhaps it isn't possible that the OS or the hardware ever returns 0 here. 
From the public API contract perspective there's nothing preventing it from 
happening though. It's a bit strange for me to see the internal implementation 
accepts a stricter requirement.

-------------

PR: https://git.openjdk.org/jdk/pull/11722

Reply via email to