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

Quan Anh Mai qamai at openjdk.org
Tue Nov 5 14:51:34 UTC 2024


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

>> Quan Anh Mai has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - copyright year
>>  - address reviews
>
> 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.

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

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


More information about the core-libs-dev mailing list