RFR: 8282379: [LOOM] vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011 sometimes fails [v2]
Chris Plummer
cjplummer at openjdk.org
Tue Feb 7 02:24:44 UTC 2023
On Tue, 7 Feb 2023 01:49:39 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011t.java line 94:
>>
>>> 92: while(!doExit) {
>>> 93: l--; l++;
>>> 94: Thread.currentThread().sleep(0);
>>
>> BTW this is an anti-pattern - use `Thread.sleep(n)` - it always applies to the current thread.
>
> What about replacing sleep(0) with yield()?
> Do we expect it also causing deadlocks? Was it considered?
sleep(0) on a virtual thread ends up doing a tryYield(), which is the same as what is done when calling sleep(0), so it should work, although I'm not so sure it is any better.
-------------
PR: https://git.openjdk.org/jdk/pull/12420
More information about the serviceability-dev
mailing list