On Wed, 10 Jan 2024 17:18:41 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> While this might not fix 8314515, it should at least make it more exact.
>
> test/jdk/java/util/concurrent/SynchronousQueue/Fairness.java line 42:
> 
>> 40:     private static void testFairness(boolean fair,
>> 41:                                      final SynchronousQueue<Integer> q,
>> 42:                                      final VarHandle underlyingHandle)
> 
> The updated approach to wait until the thread is finished putting seems okay. 
> It might be a bit cleaner for the param to testFariness be the underlying LTQ 
> rather than calling it with a VarHandle, meaning do this in the caller.

I tried that first, but since the SynchronousQueue needs to be the one 
interfaced with it means passing in a SynchronousQueue and a 
LinkedTransferQueue pair where there is a silent dependency between the two 
(the LTQ needs to be the Transferer of the SynchronousQueue) so I found it 
safer, and more straightforward to obtain it in testFairness.

What might make it cleaner still, would be to move the creation of the MH to a 
static and not pass that in as an argument, so I'll do that instead. 👍

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17082#discussion_r1447727942

Reply via email to