This PR proposes to improve the handling of the fields in 
`LazyCollections.Mutexes` so that it becomes more evident there are no races. 
It is also proposed to add a defensive check of `mutexes` so that it is obvious 
for a reader that the `Unsafe` operation does not operate on `null`.  
Furthermore, it is proposed to remove the extra `AtomicInteger` object and use 
an `int` field directly.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Improve comments
 - Add comments and add explicit semantics
 - Rework how Mutexes works

Changes: https://git.openjdk.org/jdk/pull/32070/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32070&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8389250
  Stats: 15 lines in 1 file changed: 7 ins; 1 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/32070.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32070/head:pull/32070

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

Reply via email to