Skip to content

Commit

Permalink
8264672: runtime/ParallelLoad/ParallelSuperTest.java timed out
Browse files Browse the repository at this point in the history
Reviewed-by: hseigel, lfoltan, dholmes
  • Loading branch information
coleenp committed Apr 8, 2021
1 parent ec599da commit 255afbe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/hotspot/jtreg/runtime/ParallelLoad/MyLoader.java
Expand Up @@ -61,6 +61,7 @@ public Class loadClass(String name) throws ClassNotFoundException {
private static boolean parallel = false;
private Object sync = new Object();
private Object thread_sync = new Object();
private static volatile boolean waiting = false;

private void makeThreadWait() {
if (!parallel) { return; }
Expand All @@ -73,6 +74,7 @@ private void makeThreadWait() {
synchronized(sync) {
try {
ThreadPrint.println("t1 waits parallelCapable loader");
waiting = true;
sync.wait(); // Give up lock before request to load B
} catch (InterruptedException e) {}
}
Expand All @@ -88,6 +90,11 @@ private void makeThreadWait() {
// Non-parallelCapable class loader thread will be woken up by the jvm.
private void wakeUpThread() {
if (isRegisteredAsParallelCapable()) {
while (!waiting) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {}
}
synchronized(sync) {
sync.notify();
}
Expand Down

1 comment on commit 255afbe

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.