Skip to content

Commit 255afbe

Browse files
committedApr 8, 2021
8264672: runtime/ParallelLoad/ParallelSuperTest.java timed out
Reviewed-by: hseigel, lfoltan, dholmes
1 parent ec599da commit 255afbe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎test/hotspot/jtreg/runtime/ParallelLoad/MyLoader.java

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public Class loadClass(String name) throws ClassNotFoundException {
6161
private static boolean parallel = false;
6262
private Object sync = new Object();
6363
private Object thread_sync = new Object();
64+
private static volatile boolean waiting = false;
6465

6566
private void makeThreadWait() {
6667
if (!parallel) { return; }
@@ -73,6 +74,7 @@ private void makeThreadWait() {
7374
synchronized(sync) {
7475
try {
7576
ThreadPrint.println("t1 waits parallelCapable loader");
77+
waiting = true;
7678
sync.wait(); // Give up lock before request to load B
7779
} catch (InterruptedException e) {}
7880
}
@@ -88,6 +90,11 @@ private void makeThreadWait() {
8890
// Non-parallelCapable class loader thread will be woken up by the jvm.
8991
private void wakeUpThread() {
9092
if (isRegisteredAsParallelCapable()) {
93+
while (!waiting) {
94+
try {
95+
Thread.sleep(1);
96+
} catch (InterruptedException e) {}
97+
}
9198
synchronized(sync) {
9299
sync.notify();
93100
}

0 commit comments

Comments
 (0)