Withdrawn: 8315351: Rid synchronization in PipedInputStream.close() in favour of benign race

Sergey Tsypanov stsypanov at openjdk.org
Thu Aug 31 06:10:08 UTC 2023


On Wed, 30 Aug 2023 09:49:39 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

> Assuming that the value written into `in` is always `-1` we can rid synchronized block in favour of guarding `in = - 1` with writing into volatile `closedByReader `:
> 
> public void close() throws IOException {
>     closedByReader = true;
>     synchronized (this) {
>         in = -1;
>     }
> }
> 
> -->
> 
> public void close() throws IOException {
>     in = -1;
>     closedByReader = true;
> }

This pull request has been closed without being integrated.

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

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


More information about the core-libs-dev mailing list