RFR: 8345052: Harden StampedLock

Viktor Klang vklang at openjdk.org
Wed Nov 27 15:37:45 UTC 2024


On Tue, 26 Nov 2024 18:07:41 GMT, Doug Lea <dl at openjdk.org> wrote:

> This applies the same kinds of recovery on OOME (by spinning) and JVM Exceptions (by cancelling) seen in AQS.

src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java line 1272:

> 1270:                 if ((interrupted |= Thread.interrupted()) && interruptible)
> 1271:                     break;
> 1272:                 spins = postSpins = (byte)((postSpins << 1) | 1);

@DougLea Any specific reason to move the updates to `spins` and `postSpins` to after the park?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22396#discussion_r1860877221


More information about the core-libs-dev mailing list