File tree 1 file changed +7
-0
lines changed
test/hotspot/jtreg/runtime/ParallelLoad
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ public Class loadClass(String name) throws ClassNotFoundException {
61
61
private static boolean parallel = false ;
62
62
private Object sync = new Object ();
63
63
private Object thread_sync = new Object ();
64
+ private static volatile boolean waiting = false ;
64
65
65
66
private void makeThreadWait () {
66
67
if (!parallel ) { return ; }
@@ -73,6 +74,7 @@ private void makeThreadWait() {
73
74
synchronized (sync ) {
74
75
try {
75
76
ThreadPrint .println ("t1 waits parallelCapable loader" );
77
+ waiting = true ;
76
78
sync .wait (); // Give up lock before request to load B
77
79
} catch (InterruptedException e ) {}
78
80
}
@@ -88,6 +90,11 @@ private void makeThreadWait() {
88
90
// Non-parallelCapable class loader thread will be woken up by the jvm.
89
91
private void wakeUpThread () {
90
92
if (isRegisteredAsParallelCapable ()) {
93
+ while (!waiting ) {
94
+ try {
95
+ Thread .sleep (1 );
96
+ } catch (InterruptedException e ) {}
97
+ }
91
98
synchronized (sync ) {
92
99
sync .notify ();
93
100
}
You can’t perform that action at this time.
0 commit comments