On Tue, 5 Nov 2024 14:43:29 GMT, Jorn Vernee <jver...@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

Reply via email to