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

Jorn Vernee jvernee at openjdk.org
Tue Nov 5 15:16:34 UTC 2024


On Tue, 5 Nov 2024 14:49:09 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> test/jdk/java/foreign/TestMemorySession.java line 374:
>> 
>>> 372:                     Thread.onSpinWait();
>>> 373:                     k = lock.get();
>>> 374:                 }
>> 
>> I think the right primitive here is a `CyclicBarrier` with 2 parties. Each thread will then wait for the other before continuing to the next iteration.
>
> 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.

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

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


More information about the core-libs-dev mailing list