On Tue, 25 Aug 2026 15:05:41 GMT, Viktor Klang <[email protected]> wrote:

>> Fabian Meumertzheim has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Address comments
>
> test/jdk/java/util/concurrent/forkjoin/GetMultipleWaiters.java line 110:
> 
>> 108:             a.start();
>> 109:             while (a.getState() != Thread.State.TIMED_WAITING)
>> 110:                 Thread.sleep(1);
> 
> I'd create a static method for this, something like:
> 
> 
> static void startAndAwaitState(Thread t, Thread.State state) throws Exception 
> {
>     t.start();
>     while(t.getState() != state)
>         Thread.sleep(1);
> }
> 
> 
> That would reduce the number of places where sleep adjustments would need to 
> get made.
> 
> You could even go as far as:
> 
> 
> static Thread startThreadAndAwaitState(Runnable r, String name, Thread.State 
> state) throws Exception {
>     var t = new Thread(r, name);
>     t.start();
>     while(t.getState() != state)
>         Thread.sleep(1);
>     return t;
> }

Done. Do you want me to move the `Thread#start` calls into the try-finally 
block or is that overly cautious?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32485#discussion_r3854710674

Reply via email to