Skip to content

Commit b8b4493

Browse files
author
Serguei Spitsyn
committed
8371502: serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java failing
Reviewed-by: lmesnik, amenkov Backport-of: c46bed7
1 parent c46e635 commit b8b4493

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/ThreadListStackTracesTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,13 @@ static void sleep(long millis) {
4444
}
4545
}
4646

47+
public void ensureReadyAndWaiting(Thread vt, Thread.State expState, ReentrantLock rlock) {
48+
// wait while the thread is not ready or thread state is unexpected
49+
while (!threadReady || (vt.getState() != expState) || !rlock.hasQueuedThreads()) {
50+
sleep(1);
51+
}
52+
}
53+
4754
public void ensureReady(Thread vt, Thread.State expState) {
4855
// wait while the thread is not ready or thread state is unexpected
4956
while (!threadReady || (vt.getState() != expState)) {
@@ -97,7 +104,7 @@ private static void checkReentrantLock() throws InterruptedException {
97104
String name = "ReentrantLockTestTask";
98105
TestTask task = new ReentrantLockTestTask();
99106
Thread vt = Thread.ofVirtual().name(name).start(task);
100-
task.ensureReady(vt, expState);
107+
task.ensureReadyAndWaiting(vt, expState, reentrantLock);
101108
checkStates(vt, expState);
102109
}
103110

0 commit comments

Comments
 (0)