On Wed, 30 Aug 2023 09:49:39 GMT, Sergey Tsypanov <stsypa...@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

Reply via email to