RFR: Better jdb support for vthreads. Improved jdb vthread testing support. [v3]

Serguei Spitsyn sspitsyn at openjdk.java.net
Tue Mar 8 08:12:25 UTC 2022


On Tue, 8 Mar 2022 05:26:53 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Yeah, that got misplaced, probably when I shuffled around some code. I think it would be correct if it was moved below the `addThread()` call and was changed to:
>> 
>> `            assert !(added && !eventThread.isVirtual());`
>> 
>> which is probably more easily read as:
>> 
>> `            assert !added || eventThread.isVirtual());`
>> 
>> First I need to see if I can even get asserts enabled since that one should have been triggered.
>
> Actually that's not quite right either. It looks like it needs to be:
> 
> 
>             if (added) {
>                 assert eventThread.isVirtual();
>             }
> 
> If this thread was added, it must be an a virtual thread, because if it was not it would have been previously added by a ThreadStart event.

It is better to add a comment explaining this.
Otherwise, it is hard to understand why this conclusion was made.
Also, why do you think this is not equal to your conditional assert above?:
   assert !added || eventThread.isVirtual());

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

PR: https://git.openjdk.java.net/loom/pull/97


More information about the loom-dev mailing list