File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01 Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2003, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2003, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -107,6 +107,7 @@ public int runIt(String argv[], PrintStream out) {
107
107
class cm01t002Thread extends Thread {
108
108
public Object startingMonitor = new Object ();
109
109
private Object waitingMonitor = new Object ();
110
+ private boolean timeToDie = false ;
110
111
111
112
public cm01t002Thread (String name ) {
112
113
super (name );
@@ -128,7 +129,14 @@ public void run() {
128
129
129
130
// wait on monitor
130
131
try {
131
- waitingMonitor .wait (cm01t002 .timeout );
132
+ long maxTime = System .currentTimeMillis () + cm01t002 .timeout ;
133
+ while (!timeToDie ) {
134
+ long timeout = maxTime - System .currentTimeMillis ();
135
+ if (timeout <= 0 ) {
136
+ break ;
137
+ }
138
+ waitingMonitor .wait (timeout );
139
+ }
132
140
} catch (InterruptedException ignore ) {
133
141
// just finish
134
142
}
@@ -144,6 +152,7 @@ public boolean checkReady() {
144
152
145
153
public void letFinish () {
146
154
synchronized (waitingMonitor ) {
155
+ timeToDie = true ;
147
156
waitingMonitor .notify ();
148
157
}
149
158
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2003, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2003, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -99,6 +99,11 @@ static int prepare() {
99
99
if (!NSK_JVMTI_VERIFY(jvmti->Deallocate ((unsigned char *)threads)))
100
100
return NSK_FALSE;
101
101
102
+ if (thread == NULL ) {
103
+ nsk_lcomplain (__FILE__, __LINE__, " tested thread not found\n " );
104
+ return NSK_FALSE;
105
+ }
106
+
102
107
/* get tested thread class */
103
108
if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass (thread)) != NULL ))
104
109
return NSK_FALSE;
You can’t perform that action at this time.
0 commit comments