On Tue, 5 Nov 2024 14:49:09 GMT, Quan Anh Mai <qa...@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

Reply via email to