On Mon, 17 Jun 2024 13:00:11 GMT, Alan Bateman <[email protected]> wrote:
>> test/hotspot/jtreg/serviceability/dcmd/thread/PrintMountedVirtualThread.java
>> line 43:
>>
>>> 41: public void run(CommandExecutor executor) throws
>>> InterruptedException {
>>> 42: var shouldFinish = new AtomicBoolean(false);
>>> 43: var started = new AtomicBoolean();
>>
>> Not sure how this change make things better? Why would we want to sleep and
>> poll rather than park until signalled?
>
> `started.countDown()` is replaced with `started.set(true)` to remove the
> possibility that "Dummy Vthread" unmounts here.
@AlanBateman explained to me why that is possible in
https://github.com/openjdk/jdk/pull/19482#issuecomment-2166116062 and
https://github.com/openjdk/jdk/pull/19482#issuecomment-2167374446.
Alan can correct me if I'm wrong, but I think that the dummy thread trying to
unpark the main (virtual) thread needs to run as the carrier to avoid nested
parking. See:
https://github.com/openjdk/jdk/blob/412e306d81209c05f55aee7663f7abb80286e361/src/java.base/share/classes/java/lang/VirtualThread.java#L707
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19744#discussion_r1642814467