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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • In Review

      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;
          }
      }

            Assignee:
            Sergey Tsypanov
            Reporter:
            Sergey Tsypanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: