RFR: 8343394: Make MemorySessionImpl.state a stable field [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Nov 5 15:33:30 UTC 2024


On Tue, 5 Nov 2024 15:13:29 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> I'm afraid that it would be too expensive compared to a spinlock, and the scheduler might not wake up the threads soon enough to make a meaningful race, greatly reducing the effectiveness of the test.
>
> Okay, fair enough.

Using two blocking queues might also be possible:
* at the start of each iteration a thread does a `get` on its own queue
* at the end of each iteration, a thread does a put on the other thread's queue
* we call put on the first thread's queue, to get things moving

This should create the desired "ping-pong" effect.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21810#discussion_r1829563292


More information about the core-libs-dev mailing list