Skip to content

Commit 9a16bee

Browse files
author
Andrew Lu
committed
8310551: vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java timed out due to missing prompt
Backport-of: c84866ac0dcda487fe2abc2a8841f237df0a395b
1 parent ed37e2d commit 9a16bee

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2023, 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
@@ -90,7 +90,7 @@ public static int run(String argv[], PrintStream out) {
9090
static final String LAST_BREAK = DEBUGGEE_CLASS + ".breakHere";
9191
static final String MYTHREAD = "MyThread";
9292
static final String DEBUGGEE_THREAD = DEBUGGEE_CLASS + "$" + MYTHREAD;
93-
static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notInterrupted.get()";
93+
static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notInterrupted";
9494

9595
static int numThreads = nsk.jdb.interrupt.interrupt001.interrupt001a.numThreads;
9696

test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001a.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2023, 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
@@ -56,8 +56,8 @@ public void run() {
5656
lock.wait();
5757
}
5858
} catch (InterruptedException e) {
59-
notInterrupted.decrementAndGet();
6059
synchronized (waitnotify) {
60+
notInterrupted--;
6161
waitnotify.notify();
6262
}
6363
}
@@ -83,7 +83,7 @@ static void breakHere () {}
8383
private JdbArgumentHandler argumentHandler;
8484
private Log log;
8585

86-
public static final AtomicInteger notInterrupted = new AtomicInteger(numThreads);
86+
public static volatile int notInterrupted = numThreads;
8787

8888
public int runIt(String args[], PrintStream out) {
8989

@@ -122,8 +122,8 @@ public int runIt(String args[], PrintStream out) {
122122

123123
long waitTime = argumentHandler.getWaitTime() * 60 * 1000;
124124
long startTime = System.currentTimeMillis();
125-
while (notInterrupted.get() > 0 && System.currentTimeMillis() - startTime <= waitTime) {
126-
synchronized (waitnotify) {
125+
synchronized (waitnotify) {
126+
while (notInterrupted > 0 && System.currentTimeMillis() - startTime <= waitTime) {
127127
try {
128128
waitnotify.wait(waitTime);
129129
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)