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

Reply via email to