On Mon, 18 Dec 2023 20:37:29 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

> I'm working on a test where I just added a CountDownLatch(1) and am wondering 
> if I should do the same, but I'm not sure if there is something about these 
> tests that is motivating the change.

CountDownLatch is great for many tests. It's not as powerful as a Phaser of 
course but good enough and usually easy to understand quickly what is going on. 
However, for tests that are testing thread state then you often want to have as 
few dependencies as possible. In the case of CountDownlatch, the await method 
may park. The countDown method may have to unpark waiters for for virtual 
threads it means potentially parking (to queue a task) when unparking, so 
temporary transitions that JVMTI has to be concerned with. The other thing is 
keeping tests simple/consistent, it can be hard to maintain tests where one 
test method coordinates with one approach, another test method does something 
different.

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

PR Comment: https://git.openjdk.org/jdk/pull/17136#issuecomment-1862390382

Reply via email to